-
-
Notifications
You must be signed in to change notification settings - Fork 826
make sure About dialog text is shown localized #7773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,44 +4,16 @@ | |
| #This file is covered by the GNU General Public License. | ||
| #See the file COPYING for more details. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps a module level doc string to say "This module is for UI specific / translatable version information. The source of this information should come from the non-translated buildVersion module so that it can be used in parts of nvda that are executed pre-translation system initialisation." |
||
| """ | ||
| 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 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest some module level doc string to indicate that "this module is for non-localised version information. It should not contain UI strings or translatable strings. The versionInfo module is the correct place for that"