[erlang-questions] Strings as Lists
Wed Feb 13 15:05:03 CET 2008
2008/2/13 Hynek Vychodil <>:
> You can do it only because ISO-8859-1 is enough for you. Your code will be
> crap for me, because I would not use it! One char not equal to one byte,
> remeber it! List is best solution for all non english world, because one
> list element equals to one char. If you want make onelingual programs,
> continue in your practise. God save you.
Well you really should take strings out of source code if you need
i18n. The litterals one can keep in source code are those for protocol
framing... say the "HTTP 200 OK" reply in http or "EHLO fqdn" in smtp.
Nobody would love lots of case Lang of en -> <<"Hello">>; sv ->
<<"Hej">>; es -> <<"Hola">> end in the code.
Once you go i18n(hello) you can treat everything as utf8 encoded
binaries and just piece it together.
More information about the erlang-questions