zsiki / GeoEasy

land surveying calculation, network adjustment, digital terrain models, regression calculation
http://digikom.hu/english/geo_easy_e.html
GNU General Public License v2.0
72 stars 34 forks source link

i18n for Windows? #148

Closed zvezdochiot closed 3 years ago

zvezdochiot commented 3 years ago

UTF-8

When building under Windows, it is necessary to translate Russian localization files from UTF-8 to CP1251. Is it possible to somehow solve this problem?

See also: https://geodesist.ru/threads/geoeasy-3-0-3.70513/

zsiki commented 3 years ago

Using iconv (on Linux) you can convert to code page 1251. Change directory to the i18.

mv geo_easy.rus geo_easy.rus.utf8
iconv -f utf8 -t geo_easy.rus.utf8 > geo_easy.rus
mv com_easy.rus com_easy.rus.utf8
iconv -f utf8 -t com_easy.rus.utf8 > com_easy.rus

Please send me a notice if it solves the issue.

zvezdochiot commented 3 years ago

@zsiki say:

Using iconv (on Linux) you can convert to code page 1251.

This is a bad decision! This will fix localization under win, but ruin under linux!

May be use https://tcl.tk/man/tcl/TclCmd/encoding.htm . I just didn't understand how to get the system encoding.

zsiki commented 3 years ago

I just asked you to try it, if it solve the problem I will make a solution for it. I DID NOT tell you this is the solution! I have no Russian windows to test.

zvezdochiot commented 3 years ago

Ok. I can do this in a separate branch. But I am not doing assemblies (freewrap). How can I test the result?

zsiki commented 3 years ago

If you have a Windows installation just replace the geo_easy.rus file in the i18 folder and restart the program.

zvezdochiot commented 3 years ago

Make new branch and commit: https://github.com/Geo-Linux-Calculations/GeoEasy/commit/561e22f4486b34448c0e12ec28dc90e76003839d

@zsiki say:

If you have a Windows installation just replace the geo_easy.rus file in the i18 folder and restart the program.

Test ok:
i18n-russian-cp1251
Good!

https://github.com/Geo-Linux-Calculations/GeoEasy/releases/tag/3.1.4-dev-cp1251

XRolland commented 3 years ago

Hi,

I'm following this issue because I asked myself which code page when I started french localization (which stays at a very early state today). I looked in the doc, but I didn't find any guideline about that (but I may have messed it). Looking into Win package, I noticed that there was heterogeneous code page:

Zoltan, could you, please help us in giving us some guidelines for character encoding in l10n? Or maybe it could be just a header line in the l10n file as it'used to be in Python? Thanks!

zsiki commented 3 years ago

@XRolland, I did not investigate much in this issue so far. Probably the best solution would be to maintain all language files in the same code page and convert it to the local one during installation or at the program start up. Please help me to find a good solution! For Linux I suppose UTF-8 is OK for most of the languages (except Chinese, I guess). At the start up of the program the "HKEY_LOCAL_MACHINE\SYSTEM\CONTROLSET001\control\nls\language InstallLanguage" is queried from the registry on Windows. It returns some Windows specific code. There is a huge table of codes here: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c?redirectedfrom=MSDN. I maintain an array langCodes in the geo_easy.msk file, but it won't work for all Windows versions and language variants. @XRolland you can edit/translate message files using UTF-8, using iconv we can convert it to other code page later if necessary. As far as I know there are different code page for French Canadian, so it can be more complex. I wish Windows used UTF-8!

zsiki commented 3 years ago

Searching for solution I realized there are more language settings on Windows beside install language: https://stackoverflow.com/questions/1610337/how-can-i-find-the-current-windows-language-from-cmd

zsiki commented 3 years ago

Issue #75 was opened 2 years ago...

zvezdochiot commented 3 years ago

@XRolland , if under win, then you can use https://notepad-plus-plus.org/ for transcoding.

XRolland commented 3 years ago

@zsiki I'm not a coder, isn't it better to use, if possible, UTF-8 for all l10n files? But I won't be able to help you to manage a correct display under Windows...

In fact, I stupidly thought that Windows was using UTF-8 since Seven! Crazy man...

@zvezdochiot Thanks for your suggestion. It's my default text editor! ;-)

zsiki commented 3 years ago

Source utf-8 encoded message with proc encsource from here: https://wiki.tcl-lang.org/page/source+with+encoding