From e2ee44617ce59082e6199dbb884cd0819cd7883c Mon Sep 17 00:00:00 2001 From: Pablo Polvorin Date: Mon, 19 Jan 2009 13:44:43 +0000 Subject: [PATCH] translate.erl: Bugfix, ?MYLANG macro returns a list(). SVN Revision: 1828 --- ChangeLog | 4 ++++ src/translate.erl | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a3b0c38b..e283e15f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-01-19 Pablo Polvorin + + * src/translate.erl: Bugfix, ?MYLANG macro returns a list(). + 2009-01-19 Jean-Sébastien Pédron Merge from trunk (r1752 to r1787). diff --git a/src/translate.erl b/src/translate.erl index df76d145e..f54fe6f86 100644 --- a/src/translate.erl +++ b/src/translate.erl @@ -105,6 +105,7 @@ load_file(Lang, File) -> end. translate(Lang, Msg) -> + io:format("translate(~p, ~p) ~n",[Lang, Msg]), LLang = ascii_tolower(Lang), case ets:lookup(translations, {LLang, Msg}) of [{_, Trans}] -> @@ -132,13 +133,15 @@ translate(Lang, Msg) -> end. translate(Msg) -> + %%TODO: ?MYLANG macro returns lang as a list(). Lang should be a binary. case ?MYLANG of undefined -> Msg; - <<"en">> -> + "en" -> Msg; Lang -> - LLang = ascii_tolower(Lang), + BLang = list_to_binary(Lang), + LLang = ascii_tolower(BLang), case ets:lookup(translations, {LLang, Msg}) of [{_, Trans}] -> Trans; @@ -152,7 +155,7 @@ translate(Msg) -> case ShortLang of <<"en">> -> Msg; - Lang -> + BLang -> Msg; _ -> case ets:lookup(translations, {ShortLang, Msg}) of