# ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ***** END GPL LICENSE BLOCK ***** # # Global settings used by all scripts in this dir. # XXX Before any use of the tools in this dir, please make a copy of this file # named "setting.py" # XXX This is a template, most values should be OK, but some you’ll have to # edit (most probably, BLENDER_EXEC and SOURCE_DIR). import os.path ############################################################################### # MISC ############################################################################### # The min level of completeness for a po file to be imported from /branches # into /trunk, as a percentage. -1 means "import everything". IMPORT_MIN_LEVEL = -1 # The comment prefix used in generated messages.txt file. COMMENT_PREFIX = "#~ " # The comment prefix used to mark sources of msgids, in po's. COMMENT_PREFIX_SOURCE = "#: " # The comment prefix used in generated messages.txt file. CONTEXT_PREFIX = "MSGCTXT:" # Default context. CONTEXT_DEFAULT = "" # Undocumented operator placeholder string. UNDOC_OPS_STR = "(undocumented operator)" # The gettext domain. DOMAIN = "blender" # Our own "gettext" stuff. # File type (ext) to parse. PYGETTEXT_ALLOWED_EXTS = {".c", ".cpp", ".cxx", ".hpp", ".hxx", ".h"} # Where to search contexts definitions, relative to SOURCE_DIR (defined below). 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! PYGETTEXT_CONTEXTS = "#define\\s+(BLF_I18NCONTEXT_[A-Z_0-9]+)\\s+\"([^\"]*)\"" # Keywords' regex. # XXX Most unfortunately, we can't use named backreferences inside character sets, # which makes the regexes even more twisty... :/ _str_base = ( # Match void string "(?P<{_}1>[\"'])(?P={_}1)" # Get opening quote (' or "), and closing immediately. "|" # Or match non-void string "(?P<{_}2>[\"'])" # Get opening quote (' or "). "(?{capt}(?:" # This one is for crazy things like "hi \\\\\" folks!"... r"(?:(?!<\\)(?:\\\\)*\\(?=(?P={_}2)))|" # The most common case. ".(?!(?P={_}2))" ")+.)" # Don't forget the last char! "(?P={_}2)" # And closing quote. ) str_clean_re = _str_base.format(_="g", capt="P") # 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*(?=[\"'])(?:" + _str_base.format(_="{_}2_", capt=":") + # End of loop. "))*" ) _ctxt_re = r"(?P(?:" + _str_whole_re.format(_="_ctxt") + r")|(?:[A-Z_0-9]+))" _msg_re = r"(?P" + _str_whole_re.format(_="_msg") + r")" PYGETTEXT_KEYWORDS = (() + tuple((r"{}\(\s*" + _msg_re + r"\s*\)").format(it) for it in ("IFACE_", "TIP_", "N_")) + tuple((r"{}\(\s*" + _ctxt_re + r"\s*,\s*"+ _msg_re + r"\s*\)").format(it) for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_")) ) ESCAPE_RE = ( ('((?