forked from blender/blender
me-main #1
@ -26,6 +26,7 @@ __all__ = (
|
|||||||
"register_tool",
|
"register_tool",
|
||||||
"make_rna_paths",
|
"make_rna_paths",
|
||||||
"manual_map",
|
"manual_map",
|
||||||
|
"manual_language_code",
|
||||||
"previews",
|
"previews",
|
||||||
"resource_path",
|
"resource_path",
|
||||||
"script_path_user",
|
"script_path_user",
|
||||||
@ -1035,6 +1036,53 @@ def manual_map():
|
|||||||
yield prefix, url_manual_mapping
|
yield prefix, url_manual_mapping
|
||||||
|
|
||||||
|
|
||||||
|
# Languages which are supported by the user manual (commented when there is no translation).
|
||||||
|
_manual_language_codes = {
|
||||||
|
"ar_EG": "ar", # Arabic
|
||||||
|
# "bg_BG": "bg", # Bulgarian
|
||||||
|
# "ca_AD": "ca", # Catalan
|
||||||
|
# "cs_CZ": "cz", # Czech
|
||||||
|
"de_DE": "de", # German
|
||||||
|
# "el_GR": "el", # Greek
|
||||||
|
"es": "es", # Spanish
|
||||||
|
"fi_FI": "fi", # Finnish
|
||||||
|
"fr_FR": "fr", # French
|
||||||
|
"id_ID": "id", # Indonesian
|
||||||
|
"it_IT": "it", # Italian
|
||||||
|
"ja_JP": "ja", # Japanese
|
||||||
|
"ko_KR": "ko", # Korean
|
||||||
|
# "nb": "nb", # Norwegian
|
||||||
|
# "nl_NL": "nl", # Dutch
|
||||||
|
# "pl_PL": "pl", # Polish
|
||||||
|
"pt_PT": "pt", # Portuguese
|
||||||
|
# Portuguese - Brazil, for until we have a pt_BR version.
|
||||||
|
"pt_BR": "pt",
|
||||||
|
"ru_RU": "ru", # Russian
|
||||||
|
"sk_SK": "sk", # Slovak
|
||||||
|
# "sl": "sl", # Slovenian
|
||||||
|
"sr_RS": "sr", # Serbian
|
||||||
|
# "sv_SE": "sv", # Swedish
|
||||||
|
# "tr_TR": "th", # Thai
|
||||||
|
"uk_UA": "uk", # Ukrainian
|
||||||
|
"vi_VN": "vi", # Vietnamese
|
||||||
|
"zh_CN": "zh-hans", # Simplified Chinese
|
||||||
|
"zh_TW": "zh-hant", # Traditional Chinese
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def manual_language_code(default="en"):
|
||||||
|
"""
|
||||||
|
:return:
|
||||||
|
The language code used for user manual URL component based on the current language user-preference,
|
||||||
|
falling back to the ``default`` when unavailable.
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
language = _bpy.context.preferences.view.language
|
||||||
|
if language == 'DEFAULT':
|
||||||
|
language = _os.getenv("LANG", "").split(".")[0]
|
||||||
|
return _manual_language_codes.get(language, default)
|
||||||
|
|
||||||
|
|
||||||
# Build an RNA path from struct/property/enum names.
|
# Build an RNA path from struct/property/enum names.
|
||||||
def make_rna_paths(struct_name, prop_name, enum_name):
|
def make_rna_paths(struct_name, prop_name, enum_name):
|
||||||
"""
|
"""
|
||||||
|
@ -4,38 +4,10 @@
|
|||||||
# autopep8: off
|
# autopep8: off
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
manual_version = '%d.%d' % bpy.app.version[:2]
|
url_manual_prefix = "https://docs.blender.org/manual/%s/%d.%d/" % (
|
||||||
|
bpy.utils.manual_language_code(),
|
||||||
url_manual_prefix = "https://docs.blender.org/manual/en/" + manual_version + "/"
|
*bpy.app.version[:2],
|
||||||
|
)
|
||||||
language = bpy.context.preferences.view.language
|
|
||||||
if language == 'DEFAULT':
|
|
||||||
import os
|
|
||||||
language = os.getenv('LANG', '').split('.')[0]
|
|
||||||
|
|
||||||
LANG = {
|
|
||||||
"ar_EG": "ar",
|
|
||||||
"de_DE": "de",
|
|
||||||
"es": "es",
|
|
||||||
"fi_FI": "fi",
|
|
||||||
"fr_FR": "fr",
|
|
||||||
"id_ID": "id",
|
|
||||||
"it_IT": "it",
|
|
||||||
"ja_JP": "ja",
|
|
||||||
"ko_KR": "ko",
|
|
||||||
"pt_PT": "pt",
|
|
||||||
"pt_BR": "pt",
|
|
||||||
"ru_RU": "ru",
|
|
||||||
"sk_SK": "sk",
|
|
||||||
"sr_RS": "sr",
|
|
||||||
"uk_UA": "uk",
|
|
||||||
"vi_VN": "vi",
|
|
||||||
"zh_CN": "zh-hans",
|
|
||||||
"zh_TW": "zh-hant",
|
|
||||||
}.get(language)
|
|
||||||
|
|
||||||
if LANG is not None:
|
|
||||||
url_manual_prefix = url_manual_prefix.replace("manual/en", "manual/" + LANG)
|
|
||||||
|
|
||||||
url_manual_mapping = (
|
url_manual_mapping = (
|
||||||
("bpy.types.movietrackingsettings.refine_intrinsics_tangential_distortion*", "movie_clip/tracking/clip/toolbar/solve.html#bpy-types-movietrackingsettings-refine-intrinsics-tangential-distortion"),
|
("bpy.types.movietrackingsettings.refine_intrinsics_tangential_distortion*", "movie_clip/tracking/clip/toolbar/solve.html#bpy-types-movietrackingsettings-refine-intrinsics-tangential-distortion"),
|
||||||
|
Loading…
Reference in New Issue
Block a user