<br><br><div class="gmail_quote">On Fri, Mar 2, 2012 at 9:12 AM, Ralf Meyer <span dir="ltr"><<a href="mailto:rameyer@uni-math.gwdg.de">rameyer@uni-math.gwdg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Dear Luigi,<br>
<br>
it was as you expected: on my system,<br>
os.setlocale("de_DE.utf8")<br>
has the required effect, thanks.<br>
<br>
It is remarkable that the names of locales are so system dependent.<br>
Even more disturbing, the shell command "locale -a" showed me that my<br>
computer only knows about several German and English locales.<br>
<br>
Hence a french luatex document a colleague sends me will not work on my<br>
computer because it lacks the necessary locales, and probably my<br>
documents will not work on his computer for the same reason.  This is<br>
really bad news!  One of the great things about TeX is portability.<br>
<br>
Should one refrain from using the os library, or at least its<br>
localisation aspects, and warn users to avoid it for this reason?<br>
Should one reimplement the localisation libraries that os.setlocale is<br>
calling in luatex itself, so that users can rely on a common framework<br>
all over the world?<br></blockquote>
Every os.* is, of course, os dependant. I have a linux box that has 19 locales, another one that has 731..Of course <br>Windows and MacOS have their locale setup too.<br><br>It's a matter of robust programming then: for simple things for example maybe this is ok<br>
if os.setlocale("<your string>") == nil then<br> if os.setlocale("<another try 1>") == nil then<br>  if os.setlocale("<another try 2>") == nil then<br>
   ..  <br> end<br>
 end<br>end<br></div>but locale is a huge .. and you reinvent the wheel. <br>A common framework is icu : just jump to<br>
<a href="http://site.icu-project.org/home">http://site.icu-project.org/home</a><br>
and see how much complex localization+encoding can be.<br>
<br><br>About portability: even with tex (I mean the Knuth tex, not etex or pdftex or luatex) the same source can <br>give very different results if you use only a slightly different version of the same metafont font (given that we use the same frozen  tex version, of course). So the same result is a matter of the same boundary conditions.<br>
Things doen't change much with luatex, we have more  boundary conditions than before --- but with lua we  have much more power than before and hence we need more control.<br><br>-- <br>luigi<br><br>