Thursday, January 3, 2008

bilingue! - multilanguage

Bem, de facto é fácil. Ou melhor.... não é complicado

Num futuro post e até "amadurecer" a ideia irei mostrar o bocadito insignificante de código que faz isso.

A ideia é criar labels e na property "text" chamar um resource file que tem o código da lingua no nome.

i.e.
linguasafotografia.nl.resx para holandes
linguasafotografia.en.resx para inglês
linguasafotografia.pt.resx para português
linguasafotografia.pt-br.resx para português do Brasil
linguasafotografia.resx para um browser que nao diga que lingua prefere

links que ajudaram e muito!

este para começo, foi o primeiro que li
depois a coisa nao funcionava e dei mais umas piscinas porque estou a usar o WebDeveloper express que nao tem aquela opção

este lista os http-headers
porque às tantas tinha dúvidas se os browsers se estavam a portar bem já que isto mostrava sempre a lingua inglesa embora o meu default fosse português

este golbal.asax foi essencial
para a resolução do problema. No arranque da "aplication" a "thread culture" é logo inicializada com a do browser fazendo to o resto funcionar

aqui está a lista de culturas ISO que se podem usar


Com os testes que andei a fazer coloquei o meu firefox em NL e acabei de descobrir que, peo menos, as mensagens de autosave do post tambem são multilingue.


--------------------

Well, it is easy.. or... its not one astonishing achievement

In some future postas and after some reflection on this thing i'll do a post withh all the code stuff.

The basic ideia is binding the text property of a label (or whatever you want) to a resource file

i.e.
linguasafotografia.nl.resx for dutch
linguasafotografia.en.resx for english
linguasafotografia.pt.resx for portuguese
linguasafotografia.pt-br.resx for brazilian portuguese
linguasafotografia.resx for a default language (browser default)

really helpfull liks

ethis one was for a start
then it didnt work out and i had to swim a lot a try to look at everythink and WebDeveloper express does not have that "build resource language" option

for http-headers listing
after some testing i had doubts of what was the preferred language of my browser cause it was always showing english tough my default was portuguese

this golbal.asax solved it
when the "aplication" starts the "thread culture" is assigned to the browsers language and that made it

list of cultures and languages around the world in ISO format


with all the testing and while writing this post i just found out that google gives messages acording to the language set up in browser too :)