From af87d88d01cf5296c1734013be64e9664fe7d54b Mon Sep 17 00:00:00 2001 From: Tseng Woody Date: Mon, 28 Jun 2021 18:51:53 +0800 Subject: [PATCH] WorldVoice v1.7.1 --- addon/generics/synthDrivers/__init__.py | 2 +- buildVars.py | 57 ++++++++++++++----- site_scons/site_tools/gettexttool/__init__.py | 19 ++++--- 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/addon/generics/synthDrivers/__init__.py b/addon/generics/synthDrivers/__init__.py index 148214f..1824385 100644 --- a/addon/generics/synthDrivers/__init__.py +++ b/addon/generics/synthDrivers/__init__.py @@ -106,7 +106,7 @@ def resplit(self, pattern, string, mode): others = pattern.split(string) for other, number in zip(others, numbers): if mode == 'value': - result.extend([other, LangChangeCommand('StartNumber'), number.replace(".", " ."), LangChangeCommand('EndNumber')]) + result.extend([other, LangChangeCommand('StartNumber'), number, LangChangeCommand('EndNumber')]) elif mode == 'number': result.extend([other, LangChangeCommand('StartNumber'), ' '.join(number).replace(" . ", " ."), LangChangeCommand('EndNumber')]) result.append(others[-1]) diff --git a/buildVars.py b/buildVars.py index ae3b448..924f458 100644 --- a/buildVars.py +++ b/buildVars.py @@ -3,43 +3,58 @@ # Build customizations # Change this file instead of sconstruct or manifest files, whenever possible. -# Full getext (please don't change) -_ = lambda x : x + +# Since some strings in `addon_info` are translatable, +# we need to include them in the .po files. +# Gettext recognizes only strings given as parameters to the `_` function. +# To avoid initializing translations in this module we simply roll our own "fake" `_` function +# which returns whatever is given to it as an argument. +def _(arg): + return arg + # Add-on information variables addon_info = { - # for previously unpublished addons, please follow the community guidelines at: - # https://bitbucket.org/nvdaaddonteam/todo/raw/master/guidelines.txt - # add-on Name, internal for nvda + # add-on Name/identifier, internal for NVDA "addon_name" : "WorldVoice", # Add-on summary, usually the user visible name of the addon. - # Translators: Summary for this add-on to be shown on installation and add-on information. + # Translators: Summary for this add-on + # to be shown on installation and add-on information found in Add-ons Manager. "addon_summary" : _("WorldVoice"), # Add-on description # Translators: Long description to be shown for this add-on on add-on information from add-ons manager "addon_description" : _("WorldVoice"), # version - "addon_version" : "1.7", + "addon_version" : "1.7.1", # Author(s) "addon_author" : "Tseng Woody ", # URL for the add-on documentation support "addon_url" : "https://github.com/tsengwoody/WorldVoice", # Documentation file name - "addon_docFileName" : "readme.html", + "addon_docFileName": "readme.html", # Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional) "addon_minimumNVDAVersion" : "2019.3", # Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version) "addon_lastTestedNVDAVersion" : "2020.4", - # Add-on update channel (default is None, denoting stable releases, and for development releases, use "dev"; do not change unless you know what you are doing) - "addon_updateChannel" : None, + # Add-on update channel (default is None, denoting stable releases, + # and for development releases, use "dev".) + # Do not change unless you know what you are doing! + "addon_updateChannel": None, } - -import os.path - # Define the python files that are the sources of your add-on. -# You can use glob expressions here, they will be expanded. -pythonSources = [] +# You can either list every file (using ""/") as a path separator, +# or use glob expressions. +# For example to include all files with a ".py" extension from the "globalPlugins" dir of your add-on +# the list can be written as follows: +# pythonSources = ["addon/globalPlugins/*.py"] +# For more information on SCons Glob expressions please take a look at: +# https://scons.org/doc/production/HTML/scons-user/apd.html +pythonSources = [ + 'addon/generics/*/*.py', + 'addon/globalPlugins/*/*.py', + 'addon/synthDrivers/*/*.py', +] # Files that contain strings for translation. Usually your python sources i18nSources = pythonSources + ["buildVars.py"] @@ -47,3 +62,15 @@ # Files that will be ignored when building the nvda-addon file # Paths are relative to the addon directory, not to the root directory of your addon sources. excludedFiles = [] + +# Base language for the NVDA add-on +# If your add-on is written in a language other than english, modify this variable. +# For example, set baseLanguage to "es" if your add-on is primarily written in spanish. +baseLanguage = "en" + +# Markdown extensions for add-on documentation +# Most add-ons do not require additional Markdown extensions. +# If you need to add support for markup such as tables, fill out the below list. +# Extensions string must be of the form "markdown.extensions.extensionName" +# e.g. "markdown.extensions.tables" to add tables. +markdownExtensions = [] diff --git a/site_scons/site_tools/gettexttool/__init__.py b/site_scons/site_tools/gettexttool/__init__.py index 8bb1b8d..db9a009 100644 --- a/site_scons/site_tools/gettexttool/__init__.py +++ b/site_scons/site_tools/gettexttool/__init__.py @@ -17,9 +17,11 @@ """ from SCons.Action import Action + def exists(env): return True + XGETTEXT_COMMON_ARGS = ( "--msgid-bugs-address='$gettext_package_bugs_address' " "--package-name='$gettext_package_name' " @@ -28,23 +30,26 @@ def exists(env): "-c -o $TARGET $SOURCES" ) + def generate(env): env.SetDefault(gettext_package_bugs_address="example@example.com") env.SetDefault(gettext_package_name="") env.SetDefault(gettext_package_version="") - env['BUILDERS']['gettextMoFile']=env.Builder( + env['BUILDERS']['gettextMoFile'] = env.Builder( action=Action("msgfmt -o $TARGET $SOURCE", "Compiling translation $SOURCE"), suffix=".mo", src_suffix=".po" ) - env['BUILDERS']['gettextPotFile']=env.Builder( + env['BUILDERS']['gettextPotFile'] = env.Builder( action=Action("xgettext " + XGETTEXT_COMMON_ARGS, "Generating pot file $TARGET"), suffix=".pot") - env['BUILDERS']['gettextMergePotFile']=env.Builder( - action=Action("xgettext " + "--omit-header --no-location " + XGETTEXT_COMMON_ARGS, - "Generating pot file $TARGET"), - suffix=".pot") - + env['BUILDERS']['gettextMergePotFile'] = env.Builder( + action=Action( + "xgettext " + "--omit-header --no-location " + XGETTEXT_COMMON_ARGS, + "Generating pot file $TARGET" + ), + suffix=".pot" + )