Repository: nvaccess/nvda

Issue:
Loading NVDA with specific languages shows "Locale not supported by OS" warning message box
Hello folks! When changing the language to Kirgyz, NVDA works Properly till the restart. After that, the following error message occurs:

---------------------------
Nvda Warning
---------------------------
Locale 'Kirghiz' not supported by OS.
---------------------------
OK   
---------------------------
Steps to reproduce:
1. Open the NVDA menu.
2. Go to Preferences, General Settings.
3. Choose and select Kirgyz language from the languages list. After the restart, the error I'm talking about occurs.

NVDA version: 2018.1
Operating system: Windows 10 Fall Creators Update 64-bit.
Hope this helps.


Discussion:
cc @josephsl 

This also applies to Mongolian at least.
Also for Galician.
Looks like that's something related with dependencies, as TWBlue shows the same message with Galician.
This issue was pressent in many versions, it didn't appeared with 2018.1. Tested in various computers (Windows10 High Creators, Windows10 Creators, windows XP...).
Now I'm confirming what Iván said. Unfortunately, it seems that this is a regression bug.
[**@ivnc**](https://github.com/ivnc) commented on [13 Mar 2018, 21:33 CET](https://github.com/nvaccess/nvda/issues/8064#issuecomment-372808704 "2018-03-13T20:33:27Z - Replied by Github Reply Comments"):
> This issue was pressent in many versions, it didn't appeared with 2018.1.

Are you saying that this problem also occurred in 2017.4 and even earlier?
Yes, you’re right, at least in case of Galician.
As I said, this also happens with all TwBlue versions I've tried.

Regards

Yes, when using Mongolian local test, it gives exactly that error. I'm wondering when  it is going to be fixed. Still 18.1.1 didn't fix  it yet. :)
As noted in linked issue #8080, Macedonian also encounters this error.

I noticed when looking at: https://github.com/nvaccess/nvda/wiki/Translating

That a number of the languages affected (Mongolian, Kyrgyz, Macedonian at least), aren't listed on that page, could that be related, or is it just that the translation list on that page is out of date?

Has anyone found a workaround?
If I understand correctly from quick testing, a part from that warning, NvDA continues to function normally?
I'm guessing that the error is because wx does not have a translation database (wxstd.mo) for these languages.
This means that some standard UI elements won't have translations. E.g. Ok and cancel buttons etc.
Question is though whether we can/should suppress that warning.
I think it isn't related, because as I've said happens also with other Python applications. For example Galician, one of the affected languages, is listed in that page and is a NVDA translation since several years ago (cc @quetzatl).
It could be more related with the size of the language's community. For instance, Galician isn't present in most of big/proprietary-code applications (p.e. JAWS, without going any further). If the app in question is opensource the  probability of being translated into less diffused languages normally increments, but there still are few translated open-source apps compared to other languages. What I want to say is that probably there is one NVDA dependency that supports less languages than NVDA itself. I suppose that something similar may happen, more or less, with the other languages affected by this.

I say this from my elemental NVDA internals knowledge, but this is the option I've in mind that makes more sense for me.

BTW, could the reason why these languages don't appear in the wiki be that it was updated with 2017.3 release? Mongolian was added in 2018.2, Kyrgyz in 2018.1 and Macedonian in 2017.4, according with the changelog.

Regards.
Update: After seing the @MichaelDCurran's comment (I hadn't seen it before the original comment), it seems that our hypothesis are similar. Yes, NVDA continues to work normally after closing the warning and even if the dialog remains opened.

Resolving patch:
diff --git a/source/core.py b/source/core.py
--- a/source/core.py
+++ b/source/core.py
@@ -368,6 +368,11 @@ def handlePowerStatusChange(self):
 		wxLang=locale.FindLanguageInfo(lang.split('_')[0])
 	if hasattr(sys,'frozen'):
 		locale.AddCatalogLookupPathPrefix(os.path.join(os.getcwdu(),"locale"))
+	# #8064: Wx might know the language, but may not actually contain a translation database for that language.
+	# If we try to initialize this language, wx will show a warning dialog.
+	# Therefore treat this situation like wx not knowing the language at all.
+	if not locale.IsAvailable(wxLang.Language):
+		wxLang=None
 	if wxLang:
 		try:
 			locale.Init(wxLang.Language)


Test patch: