Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/modules/bl_i18n_utils')
-rw-r--r--release/scripts/modules/bl_i18n_utils/bl_extract_messages.py79
-rw-r--r--release/scripts/modules/bl_i18n_utils/settings.py16
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils.py2
-rwxr-xr-xrelease/scripts/modules/bl_i18n_utils/utils_languages_menu.py10
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils_spell_check.py1
5 files changed, 93 insertions, 15 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index 9f22b2417ed..21ca38bff20 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -8,6 +8,7 @@ import datetime
import os
import re
import sys
+import glob
# XXX Relative import does not work here when used from Blender...
from bl_i18n_utils import settings as settings_i18n, utils
@@ -96,7 +97,7 @@ def check(check_ctxt, msgs, key, msgsrc, settings):
if key in py_in_rna[1]:
py_in_rna[0].add(key)
if not_capitalized is not None:
- if(key[1] not in settings.WARN_MSGID_NOT_CAPITALIZED_ALLOWED and
+ if (key[1] not in settings.WARN_MSGID_NOT_CAPITALIZED_ALLOWED and
key[1][0].isalpha() and not key[1][0].isupper()):
not_capitalized.add(key)
if end_point is not None:
@@ -257,11 +258,12 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
bl_rna_base_props = set()
if bl_rna_base:
bl_rna_base_props |= set(bl_rna_base.properties.values())
- for cls_base in cls.__bases__:
- bl_rna_base = getattr(cls_base, "bl_rna", None)
- if not bl_rna_base:
- continue
- bl_rna_base_props |= set(bl_rna_base.properties.values())
+ if hasattr(cls, "__bases__"):
+ for cls_base in cls.__bases__:
+ bl_rna_base = getattr(cls_base, "bl_rna", None)
+ if not bl_rna_base:
+ continue
+ bl_rna_base_props |= set(bl_rna_base.properties.values())
props = sorted(bl_rna.properties, key=lambda p: p.identifier)
for prop in props:
@@ -449,6 +451,19 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
process_msg(msgs, bpy.app.translations.contexts.operator_default, cat_str, "Generated operator category",
reports, check_ctxt_rna, settings)
+ # Parse keymap preset preferences
+ for preset_filename in sorted(
+ os.listdir(os.path.join(settings.PRESETS_DIR, "keyconfig"))):
+ preset_path = os.path.join(settings.PRESETS_DIR, "keyconfig", preset_filename)
+ if not (os.path.isfile(preset_path) and preset_filename.endswith(".py")):
+ continue
+ preset_name, _ = os.path.splitext(preset_filename)
+
+ bpy.utils.keyconfig_set(preset_path)
+ preset = bpy.data.window_managers[0].keyconfigs[preset_name]
+ if preset.preferences is not None:
+ walk_properties(preset.preferences)
+
# And parse keymaps!
from bl_keymap_utils import keymap_hierarchy
walk_keymap_hierarchy(keymap_hierarchy.generate(), "KM_HIERARCHY")
@@ -883,6 +898,45 @@ def dump_preset_messages(msgs, reports, settings):
process_msg(msgs, settings.DEFAULT_CONTEXT, msgid, msgsrc, reports, None, settings)
+def dump_template_messages(msgs, reports, settings):
+ bfiles = [""] # General template, no name needed.
+ bfiles += glob.glob(settings.TEMPLATES_DIR + "/**/*.blend", recursive=True)
+
+ workspace_names = {}
+
+ for bfile in bfiles:
+ template = os.path.dirname(bfile)
+ template = os.path.basename(template)
+ bpy.ops.wm.read_homefile(use_factory_startup=True, app_template=template)
+ for ws in bpy.data.workspaces:
+ names = workspace_names.setdefault(ws.name, [])
+ names.append(template or "General")
+
+ from bpy.app.translations import contexts as i18n_contexts
+ msgctxt = i18n_contexts.id_workspace
+ for workspace_name in sorted(workspace_names):
+ for msgsrc in sorted(workspace_names[workspace_name]):
+ msgsrc = "Workspace from template " + msgsrc
+ process_msg(msgs, msgctxt, workspace_name, msgsrc,
+ reports, None, settings)
+
+
+def dump_addon_bl_info(msgs, reports, module, settings):
+ for prop in ('name', 'location', 'description'):
+ process_msg(
+ msgs,
+ settings.DEFAULT_CONTEXT,
+ module.bl_info[prop],
+ "Add-on " +
+ module.bl_info['name'] +
+ " info: " +
+ prop,
+ reports,
+ None,
+ settings,
+ )
+
+
##### Main functions! #####
def dump_messages(do_messages, do_checks, settings):
bl_ver = "Blender " + bpy.app.version_string
@@ -918,6 +972,16 @@ def dump_messages(do_messages, do_checks, settings):
# Get strings from presets.
dump_preset_messages(msgs, reports, settings)
+ # Get strings from startup templates.
+ dump_template_messages(msgs, reports, settings)
+
+ # Get strings from addons' bl_info.
+ import addon_utils
+ for module in addon_utils.modules():
+ if module.bl_info['support'] != 'OFFICIAL':
+ continue
+ dump_addon_bl_info(msgs, reports, module, settings)
+
# Get strings from addons' categories.
for uid, label, tip in bpy.types.WindowManager.addon_filter.keywords['items'](
bpy.context.window_manager,
@@ -1014,6 +1078,9 @@ def dump_addon_messages(module_name, do_checks, settings):
reports["check_ctxt"] = check_ctxt
dump_py_messages(msgs, reports, {addon}, settings, addons_only=True)
+ # Get strings from the addon's bl_info
+ dump_addon_bl_info(msgs, reports, addon, settings)
+
pot.unescape() # Strings gathered in py/C source code may contain escaped chars...
print_info(reports, pot)
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index fb60b07a657..a8a3ed9f4b7 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -49,7 +49,7 @@ LANGUAGES = (
(15, "Russian (Русский)", "ru_RU"),
(16, "Croatian (Hrvatski)", "hr_HR"),
(17, "Serbian (Српски)", "sr_RS"),
- (18, "Ukrainian (Український)", "uk_UA"),
+ (18, "Ukrainian (Українська)", "uk_UA"),
(19, "Polish (Polski)", "pl_PL"),
(20, "Romanian (Român)", "ro_RO"),
# Using the utf8 flipped form of Arabic (العربية).
@@ -87,7 +87,7 @@ LANGUAGES = (
# Default context, in py (keep in sync with `BLT_translation.h`)!
if bpy is not None:
- assert(bpy.app.translations.contexts.default == "*")
+ assert bpy.app.translations.contexts.default == "*"
DEFAULT_CONTEXT = "*"
# Name of language file used by Blender to generate translations' menu.
@@ -318,6 +318,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = {
"glTF 2.0 (.glb/.gltf)",
"glTF Binary (.glb)",
"glTF Embedded (.gltf)",
+ "glTF Material Output",
"glTF Original PBR data",
"glTF Separate (.gltf + .bin + textures)",
"invoke() needs to be called before execute()",
@@ -368,10 +369,11 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = {
"and AMD Radeon Pro 21.Q4 driver or newer",
"and Linux driver version xx.xx.23570 or newer",
"and NVIDIA driver version 470 or newer",
- "and Windows driver version 101.1660 or newer",
+ "and Windows driver version 101.3268 or newer",
"available with",
"brown fox",
"can't save image while rendering",
+ "category",
"constructive modifier",
"cursor",
"custom",
@@ -398,6 +400,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = {
"local",
"matrices", "no matrices",
"multi-res modifier",
+ "name",
"non-triangle face",
"normal",
"or AMD with macOS 12.3 or newer",
@@ -423,6 +426,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = {
"unsupported format",
"unsupported image format",
"unsupported movie clip format",
+ "untitled",
"vertex data",
"verts only",
"view",
@@ -519,6 +523,10 @@ REL_POTFILES_SOURCE_DIR = os.path.join("source")
# Where to search for preset names (relative to SOURCE_DIR).
REL_PRESETS_DIR = os.path.join("release", "scripts", "presets")
+# Where to search for templates (relative to SOURCE_DIR).
+REL_TEMPLATES_DIR = os.path.join("release", "scripts", "startup",
+ "bl_app_templates_system")
+
# The template messages file (relative to I18N_DIR).
REL_FILE_NAME_POT = os.path.join(REL_BRANCHES_DIR, DOMAIN + ".pot")
@@ -540,6 +548,7 @@ CUSTOM_PY_UI_FILES = [
os.path.join("scripts", "startup", "bl_ui"),
os.path.join("scripts", "startup", "bl_operators"),
os.path.join("scripts", "modules", "rna_prop_ui.py"),
+ os.path.join("scripts", "presets", "keyconfig"),
]
# An optional text file listing files to force include/exclude from py_xgettext process.
@@ -678,6 +687,7 @@ class I18nSettings:
GIT_I18N_PO_DIR = property(*(_gen_get_set_path("GIT_I18N_ROOT", "REL_GIT_I18N_PO_DIR")))
POTFILES_SOURCE_DIR = property(*(_gen_get_set_path("SOURCE_DIR", "REL_POTFILES_SOURCE_DIR")))
PRESETS_DIR = property(*(_gen_get_set_path("SOURCE_DIR", "REL_PRESETS_DIR")))
+ TEMPLATES_DIR = property(*(_gen_get_set_path("SOURCE_DIR", "REL_TEMPLATES_DIR")))
FILE_NAME_POT = property(*(_gen_get_set_path("I18N_DIR", "REL_FILE_NAME_POT")))
MO_PATH_ROOT = property(*(_gen_get_set_path("I18N_DIR", "REL_MO_PATH_ROOT")))
MO_PATH_TEMPLATE = property(*(_gen_get_set_path("I18N_DIR", "REL_MO_PATH_TEMPLATE")))
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py
index 324c3ea261d..784b206fb84 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -68,7 +68,7 @@ def locale_explode(locale):
try:
import bpy.app.translations as bpy_translations
- assert(ret == bpy_translations.locale_explode(locale))
+ assert ret == bpy_translations.locale_explode(locale)
except ModuleNotFoundError:
pass
diff --git a/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py b/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py
index 833c46a732e..428b00ebc6c 100755
--- a/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py
@@ -9,12 +9,12 @@ import os
OK = 0
MISSING = 1
TOOLOW = 2
-FORBIDDEN = 3
+SKIPPED = 3
FLAG_MESSAGES = {
OK: "",
- MISSING: "No translation yet!",
- TOOLOW: "Not enough advanced to be included...",
- FORBIDDEN: "Explicitly forbidden!",
+ MISSING: "No translation yet.",
+ TOOLOW: "Not complete enough to be included.",
+ SKIPPED: "Skipped (see IMPORT_LANGUAGES_SKIP in settings.py).",
}
@@ -25,7 +25,7 @@ def gen_menu_file(stats, settings):
for uid_num, label, uid in settings.LANGUAGES:
if uid in stats:
if uid in settings.IMPORT_LANGUAGES_SKIP:
- tmp.append((stats[uid], uid_num, label, uid, FORBIDDEN))
+ tmp.append((stats[uid], uid_num, label, uid, SKIPPED))
else:
tmp.append((stats[uid], uid_num, label, uid, OK))
else:
diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
index a2fe2dd42ba..a93f1323562 100644
--- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
@@ -750,6 +750,7 @@ class SpellChecker:
"unix",
"uuid",
"vbo", "vbos",
+ "vfx",
"vr",
"wxyz",
"xr",