2 new commits in placeMarkers: https://bitbucket.org/nvdaaddonteam/placemarkers/commits/44e0f4ce803f/ Changeset: 44e0f4ce803f Branch: None User: norrumar Date: 2014-09-27 18:10:31+00:00 Summary: Merge branch 'stable' Affected #: 1 file diff --git a/addon/doc/de/readme.md b/addon/doc/de/readme.md index a8aaf7a..aceb915 100644 --- a/addon/doc/de/readme.md +++ b/addon/doc/de/readme.md @@ -40,8 +40,8 @@ Anmerkung: Die Lesezeichen basieren auf der Position im Dokument (gezählt in Zeichen vom Dokumentanfang). Bei dynamischen Webseiten empfielt sich daher, stattdessen Suchanfragen zu verwenden. -## Changes for 3.1 ## -* Translation updates and new language. +## Änderungen für 3.1 ## +* aktualisierte Übersetzungen und neue Sprache. ## Änderungen für 3.0 ## * Unterstützung für "Navigation während alles lesen" hinzugefügt. https://bitbucket.org/nvdaaddonteam/placemarkers/commits/20024eff4ae2/ Changeset: 20024eff4ae2 Branch: master User: norrumar Date: 2014-09-27 18:21:28+00:00 Summary: Updated template according to ticket 2694. Affected #: 6 files diff --git a/buildVars.py b/buildVars.py index 842a18b..91d5a20 100755 --- a/buildVars.py +++ b/buildVars.py @@ -1,4 +1,5 @@ -# -*- Encoding: UTF-8 -*- +# -*- coding: UTF-8 -*- + # Build customizations # Change this file instead of sconstruct or manifest files, whenever possible. @@ -7,20 +8,24 @@ _ = lambda x : x # Add-on information variables addon_info = { - # add-on Name - "addon-name" : "placeMarkers", - # Add-on description - # TRANSLATORS: Summary for this add-on to be shown on installation and add-on information. - "addon-summary" : _("Place markers"), + # 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 + "addon_name" : "placeMarkers", + # 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. + "addon_summary" : _("Place markers"), # Add-on description - # Translators: Long description to be shown for this add-on on installation and add-on information - "addon-description" : _("Add-on for setting place markers on specific virtual documents"), + # Translators: Long description to be shown for this add-on on add-on information from add-ons manager + "addon_description" : _("Add-on for setting place markers on specific virtual documents"), # version - "addon-version" : "4.0-dev", + "addon_version" : "4.0-dev", # Author(s) - "addon-author" : "Noelia <nrm1977@xxxxxxxxx>, Chris <llajta2012@xxxxxxxxxxx>", + "addon_author" : u"Noelia <nrm1977@xxxxxxxxx>, Chris <llajta2012@xxxxxxxxxxx>", # URL for the add-on documentation support - "addon-url" : "http://addons.nvda-project.org"; + "addon_url" : "http://addons.nvda-project.org";, + # Documentation file name + "addon_docFileName" : "readme.html", } @@ -31,7 +36,7 @@ import os.path pythonSources = [os.path.join("addon", "*.py"), os.path.join("addon", "globalPlugins", "*.py")] # Files that contain strings for translation. Usually your python sources -i18nSources = pythonSources + ["buildVars.py", "docHandler.py"] +i18nSources = pythonSources + ["buildVars.py"] # 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. diff --git a/manifest-translated.ini.tpl b/manifest-translated.ini.tpl index 4750635..c06aa84 100755 --- a/manifest-translated.ini.tpl +++ b/manifest-translated.ini.tpl @@ -1,2 +1,2 @@ -summary = "{addon-summary}" -description = """{addon-description}""" +summary = "{addon_summary}" +description = """{addon_description}""" diff --git a/manifest.ini.tpl b/manifest.ini.tpl index 8093a3f..7de43bf 100755 --- a/manifest.ini.tpl +++ b/manifest.ini.tpl @@ -1,6 +1,7 @@ -name = {addon-name} -summary = "{addon-summary}" -description = """{addon-description}""" -author = "{addon-author}" -url = {addon-url} -version = {addon-version} +name = {addon_name} +summary = "{addon_summary}" +description = """{addon_description}""" +author = "{addon_author}" +url = {addon_url} +version = {addon_version} +docFileName = {addon_docFileName} diff --git a/readme.md b/readme.md index 011a3b3..88ae0a6 100644 --- a/readme.md +++ b/readme.md @@ -34,6 +34,7 @@ Note: The bookmark position is based on the number of characters; and therefore ## Changes for 4.0 ## * Removed fragment identifiers from bookmark filenames, which can avoid issues in ePUBREADER Firefox add-on. +* Add-on help is available from the Add-ons Manager. ## Changes for 3.1 ## * Translation updates and new language. diff --git a/sconstruct b/sconstruct index 1d54d6e..b77cfe6 100755 --- a/sconstruct +++ b/sconstruct @@ -1,5 +1,5 @@ # NVDA add-on template SCONSTRUCT file -#Copyright (C) 2012 Rui Batista <ruiandrebatista@xxxxxxxxx> +#Copyright (C) 2012, 2014 Rui Batista <ruiandrebatista@xxxxxxxxx> #This file is covered by the GNU General Public License. #See the file COPYING.txt for more details. @@ -8,7 +8,6 @@ import gettext import os import os.path import zipfile -import configobj import buildVars @@ -16,7 +15,7 @@ import buildVars def md2html(source, dest): import markdown lang = os.path.basename(os.path.dirname(source)).replace('_', '-') - title="{addonSummary} {addonVersion}".format(addonSummary=buildVars.addon_info["addon-summary"], addonVersion=buildVars.addon_info["addon-version"]) + title="{addonSummary} {addonVersion}".format(addonSummary=buildVars.addon_info["addon_summary"], addonVersion=buildVars.addon_info["addon_version"]) headerDic = { "[[!meta title=\"": "# ", "\"]]": " #", @@ -52,10 +51,11 @@ def mdTool(env): ) env['BUILDERS']['markdown']=mdBuilder -env = Environment(ENV=os.environ, tools=[mdTool]) +env = Environment(ENV=os.environ, tools=['gettexttool', mdTool]) +env.Append(**buildVars.addon_info) -addonFile = env.File("{addon-name}-{addon-version}.nvda-addon".format(**buildVars.addon_info)) +addonFile = env.File("${addon_name}-${addon_version}.nvda-addon") def addonGenerator(target, source, env, for_signature): action = env.Action(lambda target, source, env : createAddonBundleFromPath(source[0].abspath, target[0].abspath) and None, @@ -79,31 +79,7 @@ env['BUILDERS']['NVDAAddon'] = Builder(generator=addonGenerator) env['BUILDERS']['NVDAManifest'] = Builder(generator=manifestGenerator) env['BUILDERS']['NVDATranslatedManifest'] = Builder(generator=translatedManifestGenerator) -env['BUILDERS']['gettextMoFile']=env.Builder( - action=env.Action(["msgfmt -o $TARGETS $SOURCES"], lambda t, s, e : "Compiling translation %s" % s[0]), - suffix=".mo", - src_suffix=".po" -) - -env['BUILDERS']['gettextPotFile']=env.Builder( - action=env.Action(["xgettext --msgid-bugs-address='%s' --package-name='%s' --package-version='%s' -c -o $TARGETS $SOURCES" % - ("nvda-translations@xxxxxxxxxxxxx", buildVars.addon_info['addon-name'], buildVars.addon_info['addon-version']) - ], lambda t, s, e : "Generating pot file %s" % t[0]), - suffix=".pot") -env['BUILDERS']['gettextMergePotFile']=env.Builder( - action=env.Action(["xgettext --msgid-bugs-address='%s' --package-name='%s' --package-version='%s' --omit-header --no-location -c -o $TARGETS $SOURCES" % - ("nvda-translations@xxxxxxxxxxxxx", buildVars.addon_info['addon-name'], buildVars.addon_info['addon-version']) - ], lambda t, s, e : "Generating pot file %s" % t[0]), - suffix=".pot") - def createAddonHelp(dir): - if not os.path.isfile("docHandler.py"): - return - plugindir = os.path.join(dir, "globalPlugins") - docFilename = "{addonName}_docHandler.py".format(addonName=buildVars.addon_info["addon-name"]) - docPath = os.path.join(plugindir, docFilename) - docFileTarget = env.Command(docPath, "docHandler.py", Copy("$TARGET", "$SOURCE")) - env.Depends(addon, docFileTarget) docsDir = os.path.join(dir, "doc") if os.path.isfile("style.css"): cssPath = os.path.join(docsDir, "style.css") @@ -139,7 +115,7 @@ def generateManifest(source, dest): def generateTranslatedManifest(source, language, out): _ = gettext.translation("nvda", localedir=os.path.join("addon", "locale"), languages=[language]).ugettext vars = {} - for var in ("addon-summary", "addon-description"): + for var in ("addon_summary", "addon_description"): vars[var] = _(buildVars.addon_info[var]) with codecs.open(source, "r", "utf-8") as f: manifest_template = f.read() @@ -168,7 +144,7 @@ for file in pythonFiles: env.Depends(addon, file) #Convert markdown files to html -createAddonHelp("addon") # We need at least doc in English and should append an item to Help menu +createAddonHelp("addon") # We need at least doc in English and should enable the Help button for the add-on in Add-ons Manager for mdFile in env.Glob(os.path.join('addon', 'doc', '*', '*.md')): htmlFile = env.markdown(mdFile) env.Depends(htmlFile, mdFile) @@ -176,10 +152,16 @@ for mdFile in env.Glob(os.path.join('addon', 'doc', '*', '*.md')): # Pot target i18nFiles = expandGlobs(buildVars.i18nSources) -pot = env.gettextPotFile("%s.pot" % "{addon-name}".format(**buildVars.addon_info), i18nFiles) +gettextvars={ + 'gettext_package_bugs_address' : 'nvda-translations@xxxxxxxxxxxxx', + 'gettext_package_name' : buildVars.addon_info['addon_name'], + 'gettext_package_version' : buildVars.addon_info['addon_version'] + } + +pot = env.gettextPotFile("${addon_name}.pot", i18nFiles, **gettextvars) env.Alias('pot', pot) env.Depends(pot, i18nFiles) -mergePot = env.gettextMergePotFile("%s-merge.pot" % "{addon-name}".format(**buildVars.addon_info), i18nFiles) +mergePot = env.gettextMergePotFile("${addon_name}-merge.pot", i18nFiles, **gettextvars) env.Alias('mergePot', mergePot) env.Depends(mergePot, i18nFiles) diff --git a/site_scons/site_tools/gettexttool/__init__.py b/site_scons/site_tools/gettexttool/__init__.py new file mode 100644 index 0000000..fa3a937 --- /dev/null +++ b/site_scons/site_tools/gettexttool/__init__.py @@ -0,0 +1,49 @@ +""" This tool allows generation of gettext .mo compiled files, pot files from source code files +and pot files for merging. + +Three new builders are added into the constructed environment: + +- gettextMoFile: generates .mo file from .pot file using msgfmt. +- gettextPotFile: Generates .pot file from source code files. +- gettextMergePotFile: Creates a .pot file appropriate for merging into existing .po files. + +To properly configure get text, define the following variables: + +- gettext_package_bugs_address +- gettext_package_name +- gettext_package_version + + +""" +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' " + "--package-version='$gettext_package_version' " + "-c -o $TARGET $SOURCES" +) + +def generate(env): + env.SetDefault(gettext_package_bugs_address="example@xxxxxxxxxxx") + env.SetDefault(gettext_package_name="") + env.SetDefault(gettext_package_version="") + + env['BUILDERS']['gettextMoFile']=env.Builder( + action=Action("msgfmt -o $TARGET $SOURCE", "Compiling translation $SOURCE"), + suffix=".mo", + src_suffix=".po" + ) + + 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") + Repository URL: https://bitbucket.org/nvdaaddonteam/placemarkers/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.