Repository: nvaccess/nvda

Issue:
GUI: About dialog is rendered in English
Hi,

A critical showstopper found: when opening About dialog in languages other than English, content is displayed in English.

STR:

1. Switch to a language other than English (NVDA menu/Preferences/General).
2. Restart NVDA.
3. Open About dialog.

Expected: content is displayed in the new language.
Actual: English is displayed.
Severity: critical.
Affects: NVDA 2017.4 RC, master, next snapshots.

Thanks.


Discussion:
Yes, I can definitely reproduce this. But why it happened is a mystery to me...
Hi,

After testing various binary snapshot builds, it appears Python 2.7.14 upgrade from the build server is the likely culprit.

Thanks.
well, how we know that,

do you have an evidence?


W dniu 17.11.2017 o 15:20, Joseph Lee pisze:
>
> Hi,
>
> After testing various binary snapshot builds, it appears Python 2.7.14 
> upgrade from the build server is the likely culprit.
>
> Thanks.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/7770#issuecomment-345255871>, 
> or mute the thread 
> <https://github.com/notifications/unsubscribe-auth/AKohk_3oRahPhnzHjyS6IeM_mhsPWSehks5s3ZYcgaJpZM4QiDRJ>.
>


Hello, I also confirm this bug. I hope it'll be fixed in 2017.4
Hi, the last master that did work was 14539, and that was with Python 2.7.13. Starting from 14549, it started using Python 2.7.14. At the same time, next snapshots began showing this problem, with the last next snapshot with no problems being 14536. This leads me to believe that something that was committed around October 18th might be to blame, and we cannot leave out Python 2.7.14. Thanks. 

 

From: zstanecic [mailto:notifications@github.com] 
Sent: Friday, November 17, 2017 6:22 AM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Joseph Lee <joseph.lee22590@gmail.com>; Author <author@noreply.github.com>
Subject: Re: [nvaccess/nvda] GUI: About dialog is rendered in English (#7770)

 

well, how we know that,

do you have an evidence?


W dniu 17.11.2017 o 15:20, Joseph Lee pisze:
>
> Hi,
>
> After testing various binary snapshot builds, it appears Python 2.7.14 
> upgrade from the build server is the likely culprit.
>
> Thanks.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub 
> <https://github.com/nvaccess/nvda/issues/7770#issuecomment-345255871>, 
> or mute the thread 
> <https://github.com/notifications/unsubscribe-auth/AKohk_3oRahPhnzHjyS6IeM_mhsPWSehks5s3ZYcgaJpZM4QiDRJ>.
>




—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <https://github.com/nvaccess/nvda/issues/7770#issuecomment-345256223> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHgLkLrEdgsqKZ165DjZuBCHPfSSeyzEks5s3ZZqgaJpZM4QiDRJ> .


[**@josephsl**](https://github.com/josephsl) commented on [17 nov. 2017 15:20 CET](https://github.com/nvaccess/nvda/issues/7770#issuecomment-345255871 "2017-11-17T14:20:11Z - Replied by Github Reply Comments"):
> After testing various binary snapshot builds, it appears Python 2.7.14 upgrade from the build server is the likely culprit.

I tend to disagree with this finding. I"m running Python 2.7.13 on my local system, and when running from source, the about dialog is also showing up in English. Note that the title of the dialog is properly translated.
Hi,

In that case, Python is not to blame.

Further testing shows that the new likely culprit might be #7649, as prior to that, there was no problem with this dialog.

CC @MichaelDCurran
Comfirmed.

I did a git checkout 1fcc7fe, and the issue did occur. After that, i did a git checkout head~, and the translation showed up correctly. Assuming this is the right way to test this, of course.
@michaeldcurran: It could have to do with the move of the localisation initialisation. Note that all translatable strings in versionInfo show up as untranslated. This suggest versionInfo is imported without localisation being initialized properly. See logHandler around line 221:

versionInfo must be imported after the language is set. Otherwise, strings won't be in the correct language.
Therefore, don't import versionInfo if it hasn't already been imported.

May be use a similar trick for the RemoteHandler?
hello.
i should say that i dont have this problem using nvda 2017.3 (which is built with python 2.7.13!
hope that help, God bless you all.
Hi, I can't reproduce this exactly: For me, the info is also displayed in Spanish, even if I switch to catalon, French or Italian. Spanish is the language I use for Windows.
Cheers
Well, what NVDA version are you using?
Hi, I'm using NVDA 2017.4rc1. I see that, in the General dialog of preferences submenu, languages of the combo box are shown in Spanish too testing with NVDA set to English.
I've tested with the Python console copying to the clipboard the aboutMessage of versionInfo and is copied in Spanish too.

The .ini file says windows for language, I notice.
 Brian

bglists@blueyonder.co.uk
Sent via blueyonder.
Please address personal email to:-
briang1@blueyonder.co.uk, putting 'Brian Gaff'
in the display name field.
----- Original Message ----- 
From: "nvdaes" <notifications@github.com>
To: "nvaccess/nvda" <nvda@noreply.github.com>
Cc: "Subscribed" <subscribed@noreply.github.com>
Sent: Friday, November 17, 2017 4:08 PM
Subject: Re: [nvaccess/nvda] GUI: About dialog is rendered in English 
(#7770)


> Hi, I can't reproduce this exactly: For me, the info is also displayed in 
> Spanish, even if I switch to catalon, French or Italian. Spanish is the 
> language I use for Windows.
> Cheers
>
> -- 
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/7770#issuecomment-345286207 


No its definitely around the time noted, and I'm thinking Unicode for some 
reason.
Might be barking up the wrong lamp post dunno.
Brian

bglists@blueyonder.co.uk
Sent via blueyonder.
Please address personal email to:-
briang1@blueyonder.co.uk, putting 'Brian Gaff'
in the display name field.
-----  


I also can confirm this behavior.
Hi, perhaps the title of the issue should be changed to: About dialog and language names in General settings are displayed in the default language for Windows.
I've changed my language to en_us and now these are shown in English.

Cheers
We're talking about the About dialog, not about the language names of General Settings Dialog. If you're switching to another language than English and open the About dialog from Help submenu, you'll see that it is shown in English, not in the language you've set.
florianionascu7 commented 
> We're talking about the About dialog, not about the language names of General Settings Dialog. 

Maybe the two ones are caused by a common issue.

Cheers

Resolving patch:
diff --git a/source/buildVersion.py b/source/buildVersion.py
new file mode 100644
--- /dev/null
+++ b/source/buildVersion.py
@@ -0,0 +1,51 @@
+#A part of NonVisual Desktop Access (NVDA)
+#Copyright (C) 2006-2017 NV Access Limited
+#This file is covered by the GNU General Public License.
+#See the file COPYING for more details.
+
+import os
+
+"""
+This module contains non-localizable version information for NVDA such as the version string and major and minor numbers etc.
+Any localizable version information should be placed in the versionInfo module, not this one.
+This module exists separately so that it can be imported for version checks before localization is initialized.
+"""
+
+def _updateVersionFromVCS():
+	"""Update the version from version control system metadata if possible.
+	"""
+	global version
+	# The root of the Git working tree will be the parent of this module's directory.
+	gitDir = os.path.join(os.path.dirname(os.path.dirname(__file__)), ".git")
+	try:
+		head = file(os.path.join(gitDir, "HEAD"), "r").read().rstrip()
+		if not head.startswith("ref: "):
+			# Detached head.
+			version = "source-DETACHED-%s" % head[:7]
+			return
+		# Strip the "ref: " prefix to get the ref.
+		ref = head[5:]
+		commit = file(os.path.join(gitDir, ref), "r").read().rstrip()
+		version = "source-%s-%s" % (
+			os.path.basename(ref),
+			commit[:7])
+	except:
+		pass
+
+# ticket:3763#comment:19: name must be str, not unicode.
+# Otherwise, py2exe will break.
+name="NVDA"
+version_year=2017
+version_major=4
+version_minor=0
+version_build=0
+version="%s.%s.%sdev"%(version_year,version_major,version_minor)
+publisher="unknown"
+updateVersionType=None
+try:
+	from _buildVersion import version, publisher, updateVersionType, version_build
+except ImportError:
+	_updateVersionFromVCS()
+
+# A test version is anything other than a final or rc release.
+isTestVersion = not version[0].isdigit() or "alpha" in version or "beta" in version or "dev" in version
diff --git a/source/logHandler.py b/source/logHandler.py
--- a/source/logHandler.py
+++ b/source/logHandler.py
@@ -18,7 +18,7 @@
 import traceback
 from types import MethodType, FunctionType
 import globalVars
-import versionInfo
+import buildVersion
 
 ERROR_INVALID_WINDOW_HANDLE = 1400
 ERROR_TIMEOUT = 1460
@@ -190,7 +190,7 @@ class RemoteHandler(logging.Handler):
 
 	def __init__(self):
 		#Load nvdaHelperRemote.dll but with an altered search path so it can pick up other dlls in lib
-		path=os.path.abspath(os.path.join(u"lib",versionInfo.version,u"nvdaHelperRemote.dll"))
+		path=os.path.abspath(os.path.join(u"lib",buildVersion.version,u"nvdaHelperRemote.dll"))
 		h=ctypes.windll.kernel32.LoadLibraryExW(path,0,LOAD_WITH_ALTERED_SEARCH_PATH)
 		if not h:
 			raise OSError("Could not load %s"%path) 
@@ -218,11 +218,8 @@ def close(self):
 		logging.StreamHandler.close(self)
 
 	def handle(self,record):
-		# versionInfo must be imported after the language is set. Otherwise, strings won't be in the correct language.
-		# Therefore, don't import versionInfo if it hasn't already been imported.
-		versionInfo = sys.modules.get("versionInfo")
 		# Only play the error sound if this is a test version.
-		shouldPlayErrorSound = versionInfo and versionInfo.isTestVersion
+		shouldPlayErrorSound =  buildVersion.isTestVersion
 		if record.levelno>=logging.CRITICAL:
 			try:
 				winsound.PlaySound("SystemHand",winsound.SND_ALIAS)
diff --git a/source/versionInfo.py b/source/versionInfo.py
--- a/source/versionInfo.py
+++ b/source/versionInfo.py
@@ -4,44 +4,16 @@
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
 
+"""
+This module contains localizable version information such as description, copyright and About messages etc.
+As there are localizable strings at module level, this can only be imported once localization is set up via languageHandler.initialize.
+To access version information for programmatic version checks before languageHandler.initialize, use the buildVersion module which contains all the non-localizable version information such as major and minor version, and version string etc.
+"""
+ 
 import os
+from buildVersion import *
 
-def _updateVersionFromVCS():
-	"""Update the version from version control system metadata if possible.
-	"""
-	global version
-	# The root of the Git working tree will be the parent of this module's directory.
-	gitDir = os.path.join(os.path.dirname(os.path.dirname(__file__)), ".git")
-	try:
-		head = file(os.path.join(gitDir, "HEAD"), "r").read().rstrip()
-		if not head.startswith("ref: "):
-			# Detached head.
-			version = "source-DETACHED-%s" % head[:7]
-			return
-		# Strip the "ref: " prefix to get the ref.
-		ref = head[5:]
-		commit = file(os.path.join(gitDir, ref), "r").read().rstrip()
-		version = "source-%s-%s" % (
-			os.path.basename(ref),
-			commit[:7])
-	except:
-		pass
-
-# ticket:3763#comment:19: name must be str, not unicode.
-# Otherwise, py2exe will break.
-name="NVDA"
 longName=_("NonVisual Desktop Access")
-version_year=2017
-version_major=4
-version_minor=0
-version_build=0
-version="%s.%s.%sdev"%(version_year,version_major,version_minor)
-publisher="unknown"
-updateVersionType=None
-try:
-	from _buildVersion import version, publisher, updateVersionType, version_build
-except ImportError:
-	_updateVersionFromVCS()
 description=_("A free and open source screen reader for Microsoft Windows")
 url="http://www.nvaccess.org/"
 copyrightYears="2006-2017"
@@ -59,5 +31,3 @@ def _updateVersionFromVCS():
 {name} is developed by NV Access, a non-profit organisation committed to helping and promoting free and open source solutions for blind and vision impaired people.
 If you find NVDA useful and want it to continue to improve, please consider donating to NV Access. You can do this by selecting Donate from the NVDA menu.""").format(**globals())
 
-# A test version is anything other than a final or rc release.
-isTestVersion = not version[0].isdigit() or "alpha" in version or "beta" in version or "dev" in version


Test patch: