Created attachment 373525 [details] Code which may cause the problem Microsoft Windows 10 Pro Version 10.0.18363 build 18363 Use a standard Windows computer in Sweden (i.e with Swedish UI) Start GnuCash and select command "New File". Go through the steps of the Wizard until "Choose accounts to be created" The categories displayed are the ones of C:\Program Files (x86)\gnucash\share\gnucash\accounts\C Expected: the categories (Swedish) of C:\Program Files (x86)\gnucash\share\gnucash\accounts\sv to be displayed Double check: Go to Control Panel and set Display Language to Danish Go through the steps above and note how the contents of C:\Program Files (x86)\gnucash\share\gnucash\accounts\da is displayed. (as expected) Poke around in the source code and discover this: (also see attached screencap) https://github.com/Gnucash/gnucash/blob/master/gnucash/gnome/assistant-hierarchy.c#L238 I don't understand the logic, but it tests for Windows and Swedish specifically, which doesn't make sense as there are some 40 locales in C:\Program Files (x86)\gnucash\share\gnucash\accounts Why test just for Swedish (which seems to be the one which _doesn't_ work)?
It's a little convoluted. Dunno if it's still the case, but when I wrote that hack gettext (the translation library) didn't handle 'sv' in the languages list correctly on Windows, so in order to get the GnuCash UI in Swedish when the computer was set to something else one had to put LANG=Swedish_Sweden or LANG=Swedish_Finland in the environment file. That borked the account hierarchy selection, which needed sv_SE or sv_FI and this bit of code provided that. I do notice a mistake there, the Swedish_Sweden branch returns sv_SV instead of sv_SE, but unless you have LANG set in the environment file that's not what's going wrong with the Swedish account hierarchy.
Note that I'm not trying to get GnuCash UI in Swedish with the computer set to anything else. My computer is all in Swedish and so is GnuCash (although the translation is not complete). Here are some observations I have created the file "environment.local" and added the section [Variables] LANG=Swedish_Sweden LANGUAGE={LANG} When starting GnuCash, its UI is now displayed in English I have also made it so that these directories exist in the accounts directory sv sv_SE sv_SV All containing the Swedish account plans. These plans are not displayed by the New File wizard however. I currently don't have the resources to set up a Windows build environment for GnuCash.
I just found the discussion in https://bugs.gnucash.org/show_bug.cgi?id=725296 and changed environment.local to read [Variables] LANG=Swedish_Sweden LANGUAGE=sv Now GnuCash's UI is displayed in Swedish (as without any environment.local file present at all), but still no Swedish account plans in the wizard
Well, yes, if I read John's comment 1 correctly there's still a bug in the current code that will prevent gnucash from inferring the right language code for the account hierarchies if you set LANG in the environment.local file. Unfortunately not setting it will prevent the ui from being translated (which is the main topic of bug 725296). As you indicate the UI is properly translated it looks like the LANG variable is being set to Swedish_Sweden somewhere after all. If not in environment.local, is this done perhaps in the environment file itself ? Until the typo in the code snippet you refer to is fixed, you may be able to get to the Swedish account templates by making sure the environment variable "LANG" is *not* set and keep your default PC locale settings to Swedish/Sweden. This should turn the interface into English but present the Swedish account templates. After your account templates have been set up, you can set the LANG environment variable again to get a tranlsated UI.
Note I have just pushed a fix for the typo in the above code ("sv_SV" should really be "sv_SE"). Can you try with tomorrow's nightly build if you can now properly select the Swedish account templates even if the LANG environment variable is set to "Swedish_Sweden" ?
Installers for nightly builds can be found here: https://code.gnucash.org/builds/win32/maint/
Tested it myself and it's not working yet. I'm working on a followup patch.
Ok, this time I got it working. The fix will first appear in tomorrow's nightly build.
I just tried with gnucash-3.8-2020-01-16-git-3.8b-52-ge91e84e7e+.setup.exe and it works fine! A word on this LANG variable thing. I had never come across it in my ten+ years as a GnuCash (for Windows) user. Not until I began investigating this bug, so personally I don't see how it relates to this issue. To test it, I first uninstalled GnuCash and deleted all related directories (Program (x86)), Users\NN\AppData so no environment file existed. Then I installed the nightly build. When starting the program, it displayed in Swedish and the New book wizard correctly displays the account plans in the sv_SE folder. It appears to work as I expect. Thanks!
That's good to hear. And regarding LANG, it does seem like this is no longer an issue on our Windows builds. I did a similar test (setting Windows country and region settings to Swedish Sweden without setting any LANG variable) and that works as expected indeed. Apparently my suggestion in comment 4 was wrong.