Hello Michael! Unfortunately, Erlang Web does not have the autodetection mechanism of the browser's language: the language you want to be used in your service has to be set up manually (or, in fact, when you have the IP set up you can always use some geolocator).
Designing and deciding what headers/browser's information should be accessible within framework is not a trivial task though. We have to find some golden mean: or parametrize somehow the granularity. The language of the translation is chosen in the following steps: 1. stored in "session:lang" 2. from the default_language clause in project.conf 3. set to 'en' In your case, neither first option, nor the second one is found, so the translation is set up to 'en'. Moreover, you are trying to modify the 'e_dict' content by inserting some values using ets:insert. The main idea of the request dictionary is its lifetime is limited to the request time only. That means you can not access its content before or after request processing. Moreover, the new request dictionary is created per request. The only non-transient field of the dictionary is "session" (but it is going to be deleted after some timeout). Updating the e_dict ets table will not take effect anyhow - try to handle the language setting process within the controller function: wpart:fset("session:lang", 'es-es'). ----- "Michael McDaniel" <erlang...@autosys.us> wrote: > I am not sure why language translation is not working for me. > > $ uname -a > Linux delora 2.6.24-23-386 #1 Thu Nov 27 18:10:58 UTC 2008 i686 > GNU/Linux > > Erlang Web 1.2.1 > > Firefox 3.0.7 > ----------------- > > To check that my browser language setting is working I do this: > > point browser to wiki page http://wiki.erlang-web.org/I18n > > I set my browser language to either english or spanish > and the Example box titles change to my chosen language > as expected, e.g. in 'html embedding' box. > > > Now, for my test ... > > I add <wpart:lang key="greet"/> to the welcome.html > page on my installation of erlangweb-1.2.1 and configure > project.conf, en.conf, and es.conf as follows: > > > config/project.conf > --- > {http_port, 8080}. > {language_files, [{'es-es', "config/languages/es.conf"}, > {es, "config/languages/es.conf"}, > {en, "config/languages/en.conf"}]}. > > > config/languages/en.conf > --- > {"greet", "hello"}. > > > config/languages/es.conf > --- > {"greet", "hola"}. > > > > > Then start erlangweb and check ets tables ... > > > $ cd erlangweb-1.2.1 > $ bin/start_interactive yaws > > <snip startup info /> > > 1> ets:match(e_languages, '$1'). > [[{{es,"greet"},"hola"}], > [{{'es-es',"greet"},"hola"}], > [{{en,"greet"},"hello"}]] > 2> ets:match(e_conf, '$1'). > [[{template_root,"templates"}], > [{language_files,[{'es-es',"config/languages/es.conf"}, > {es,"config/languages/es.conf"}, > {en,"config/languages/en.conf"}]}], > [{http_port,8080}]] > 3> > > > > When I access welcome.html page it always says hello even if I set > browser language to Spanish, es. So, it appears that the wpart:lang > tag is being read, but the browser language choice is not getting > recognized. I thought the browser language choice was supposed > to trigger the wpart:lang language lookup. > > > I also tried setting the language in e_dict ... > > 3> ets:insert(e_dict, {lang, es}). > 4) ets:insert(e_dict, {language, es}). > 5> ets:match(e_dict, '$1'). > [[{language,es}],[{lang,es}]] > 6> > > but it made no difference - hello on the welcome.html page, not > hola. > > > I have found no errors in log/report.log or during start, and you > can see the languages configuration above. The 'es-es' setting > is because at first I tried Spanish [es-es] for my language then > switched to Spanish [es] in the browser. > > > Does anyone have suggestions of what to try next ? > > > > -- > Michael McDaniel > Portland, Oregon, USA > http://autosys.us > http://mmcdaniel.com/erlview Best regards, -- Michal Ptaszek www.erlang-consulting.com ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Erlangweb-users mailing list Erlangweb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/erlangweb-users http://www.erlang-web.org/