25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

translate.erl: Bugfix, ?MYLANG macro returns a list().

SVN Revision: 1828
This commit is contained in:
Pablo Polvorin 2009-01-19 13:44:43 +00:00
parent 25009ff9f4
commit e2ee44617c
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2009-01-19 Pablo Polvorin <pablo.polvorin@process-one.net>
* src/translate.erl: Bugfix, ?MYLANG macro returns a list().
2009-01-19 Jean-Sébastien Pédron <js.pedron@meetic-corp.com> 2009-01-19 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
Merge from trunk (r1752 to r1787). Merge from trunk (r1752 to r1787).

View File

@ -105,6 +105,7 @@ load_file(Lang, File) ->
end. end.
translate(Lang, Msg) -> translate(Lang, Msg) ->
io:format("translate(~p, ~p) ~n",[Lang, Msg]),
LLang = ascii_tolower(Lang), LLang = ascii_tolower(Lang),
case ets:lookup(translations, {LLang, Msg}) of case ets:lookup(translations, {LLang, Msg}) of
[{_, Trans}] -> [{_, Trans}] ->
@ -132,13 +133,15 @@ translate(Lang, Msg) ->
end. end.
translate(Msg) -> translate(Msg) ->
%%TODO: ?MYLANG macro returns lang as a list(). Lang should be a binary.
case ?MYLANG of case ?MYLANG of
undefined -> undefined ->
Msg; Msg;
<<"en">> -> "en" ->
Msg; Msg;
Lang -> Lang ->
LLang = ascii_tolower(Lang), BLang = list_to_binary(Lang),
LLang = ascii_tolower(BLang),
case ets:lookup(translations, {LLang, Msg}) of case ets:lookup(translations, {LLang, Msg}) of
[{_, Trans}] -> [{_, Trans}] ->
Trans; Trans;
@ -152,7 +155,7 @@ translate(Msg) ->
case ShortLang of case ShortLang of
<<"en">> -> <<"en">> ->
Msg; Msg;
Lang -> BLang ->
Msg; Msg;
_ -> _ ->
case ets:lookup(translations, {ShortLang, Msg}) of case ets:lookup(translations, {ShortLang, Msg}) of