diff options
Diffstat (limited to 'release/scripts/modules/bl_i18n_utils/settings.py')
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/settings.py | 74 |
1 files changed, 67 insertions, 7 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 0f09e8238ab..eb5fd4cd0fa 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -96,13 +96,62 @@ IMPORT_MIN_LEVEL = -1 IMPORT_LANGUAGES_SKIP = {'am', 'bg', 'fi', 'el', 'et', 'ko', 'ne', 'pl', 'ro', 'uz', 'uz@cyrillic'} # The comment prefix used in generated messages.txt file. -COMMENT_PREFIX = "#~ " +MSG_COMMENT_PREFIX = "#~ " + +# The comment prefix used in generated messages.txt file. +MSG_CONTEXT_PREFIX = "MSGCTXT:" + +# The default comment prefix used in po's. +PO_COMMENT_PREFIX= "# " # The comment prefix used to mark sources of msgids, in po's. -COMMENT_PREFIX_SOURCE = "#: " +PO_COMMENT_PREFIX_SOURCE = "#: " -# The comment prefix used in generated messages.txt file. -CONTEXT_PREFIX = "MSGCTXT:" +# The comment prefix used to mark sources of msgids, in po's. +PO_COMMENT_PREFIX_SOURCE_CUSTOM = "#. :src: " + +# The comment prefix used to comment entries in po's. +PO_COMMENT_PREFIX_MSG= "#~ " + +# The comment prefix used to mark fuzzy msgids, in po's. +PO_COMMENT_FUZZY = "#, fuzzy" + +# The prefix used to define context, in po's. +PO_MSGCTXT = "msgctxt " + +# The prefix used to define msgid, in po's. +PO_MSGID = "msgid " + +# The prefix used to define msgstr, in po's. +PO_MSGSTR = "msgstr " + +# The 'header' key of po files. +PO_HEADER_KEY = ("", "") + +PO_HEADER_MSGSTR = ( + "Project-Id-Version: Blender {blender_ver} (r{blender_rev})\\n\n" + "Report-Msgid-Bugs-To: \\n\n" + "POT-Creation-Date: {time}\\n\n" + "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\n" + "Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\n" + "Language-Team: LANGUAGE <LL@li.org>\\n\n" + "Language: {iso}\\n\n" + "MIME-Version: 1.0\\n\n" + "Content-Type: text/plain; charset=UTF-8\\n\n" + "Content-Transfer-Encoding: 8bit\n" +) +PO_HEADER_COMMENT_COPYRIGHT = ( + "# Blender's translation file (po format).\n" + "# Copyright (C) {year} The Blender Foundation.\n" + "# This file is distributed under the same license as the Blender package.\n" + "#\n" +) +PO_HEADER_COMMENT = ( + "# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n" + "#" +) + +TEMPLATE_ISO_ID = "__TEMPLATE__" # Default context. CONTEXT_DEFAULT = "" @@ -121,8 +170,7 @@ PYGETTEXT_ALLOWED_EXTS = {".c", ".cpp", ".cxx", ".hpp", ".hxx", ".h"} PYGETTEXT_MAX_MULTI_CTXT = 16 # Where to search contexts definitions, relative to SOURCE_DIR (defined below). -PYGETTEXT_CONTEXTS_DEFSRC = os.path.join("source", "blender", "blenfont", - "BLF_translation.h") +PYGETTEXT_CONTEXTS_DEFSRC = os.path.join("source", "blender", "blenfont", "BLF_translation.h") # Regex to extract contexts defined in BLF_translation.h # XXX Not full-proof, but should be enough here! @@ -146,11 +194,21 @@ _str_base = ( "(?P={_}2)" # And closing quote. ) str_clean_re = _str_base.format(_="g", capt="P<clean>") +_inbetween_str_re = ( + # XXX Strings may have comments between their pieces too, not only spaces! + r"(?:\s*(?:" + # A C comment + r"/\*.*(?!\*/).\*/|" + # Or a C++ one! + r"//[^\n]*\n" + # And we are done! + r")?)*" +) # Here we have to consider two different cases (empty string and other). _str_whole_re = ( _str_base.format(_="{_}1_", capt=":") + # Optional loop start, this handles "split" strings... - "(?:(?<=[\"'])\\s*(?=[\"'])(?:" + "(?:(?<=[\"'])" + _inbetween_str_re + "(?=[\"'])(?:" + _str_base.format(_="{_}2_", capt=":") + # End of loop. "))*" @@ -231,6 +289,8 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = { } WARN_MSGID_NOT_CAPITALIZED_ALLOWED |= set(lng[2] for lng in LANGUAGES) +PARSER_CACHE_HASH = 'sha1' + ############################################################################### # PATHS |