Extract theme property names for localization
This commit is contained in:
parent
4feee76c8e
commit
f9da6f6978
|
@ -117,9 +117,12 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
|
|||
capitalize_string_remaps["bvh"] = "BVH";
|
||||
capitalize_string_remaps["ca"] = "CA";
|
||||
capitalize_string_remaps["cd"] = "CD";
|
||||
capitalize_string_remaps["commentfocus"] = "Comment Focus";
|
||||
capitalize_string_remaps["cpu"] = "CPU";
|
||||
capitalize_string_remaps["csg"] = "CSG";
|
||||
capitalize_string_remaps["db"] = "dB";
|
||||
capitalize_string_remaps["defaultfocus"] = "Default Focus";
|
||||
capitalize_string_remaps["defaultframe"] = "Default Frame";
|
||||
capitalize_string_remaps["dof"] = "DoF";
|
||||
capitalize_string_remaps["dpi"] = "DPI";
|
||||
capitalize_string_remaps["dtls"] = "DTLS";
|
||||
|
@ -128,6 +131,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
|
|||
capitalize_string_remaps["etc2"] = "ETC2";
|
||||
capitalize_string_remaps["fbx"] = "FBX";
|
||||
capitalize_string_remaps["fft"] = "FFT";
|
||||
capitalize_string_remaps["fg"] = "FG";
|
||||
capitalize_string_remaps["fov"] = "FOV";
|
||||
capitalize_string_remaps["fps"] = "FPS";
|
||||
capitalize_string_remaps["fs"] = "FS";
|
||||
|
@ -145,6 +149,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
|
|||
capitalize_string_remaps["hdr"] = "HDR";
|
||||
capitalize_string_remaps["hidpi"] = "hiDPI";
|
||||
capitalize_string_remaps["hipass"] = "High-pass";
|
||||
capitalize_string_remaps["hseparation"] = "H Separation";
|
||||
capitalize_string_remaps["hsv"] = "HSV";
|
||||
capitalize_string_remaps["html"] = "HTML";
|
||||
capitalize_string_remaps["http"] = "HTTP";
|
||||
|
@ -177,6 +182,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
|
|||
capitalize_string_remaps["msaa"] = "MSAA";
|
||||
capitalize_string_remaps["nfc"] = "NFC";
|
||||
capitalize_string_remaps["normalmap"] = "Normal Map";
|
||||
capitalize_string_remaps["ofs"] = "Offset";
|
||||
capitalize_string_remaps["ok"] = "OK";
|
||||
capitalize_string_remaps["opengl"] = "OpenGL";
|
||||
capitalize_string_remaps["opentype"] = "OpenType";
|
||||
|
@ -195,6 +201,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
|
|||
capitalize_string_remaps["sdfgi"] = "SDFGI";
|
||||
capitalize_string_remaps["sdk"] = "SDK";
|
||||
capitalize_string_remaps["sec"] = "(sec)"; // Unit.
|
||||
capitalize_string_remaps["selectedframe"] = "Selected Frame";
|
||||
capitalize_string_remaps["sms"] = "SMS";
|
||||
capitalize_string_remaps["srgb"] = "sRGB";
|
||||
capitalize_string_remaps["ssao"] = "SSAO";
|
||||
|
@ -203,6 +210,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
|
|||
capitalize_string_remaps["ssl"] = "SSL";
|
||||
capitalize_string_remaps["stderr"] = "stderr";
|
||||
capitalize_string_remaps["stdout"] = "stdout";
|
||||
capitalize_string_remaps["sv"] = "SV";
|
||||
capitalize_string_remaps["svg"] = "SVG";
|
||||
capitalize_string_remaps["tcp"] = "TCP";
|
||||
capitalize_string_remaps["ui"] = "UI";
|
||||
|
@ -216,9 +224,12 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
|
|||
capitalize_string_remaps["uv1"] = "UV1";
|
||||
capitalize_string_remaps["uv2"] = "UV2";
|
||||
capitalize_string_remaps["uwp"] = "UWP";
|
||||
capitalize_string_remaps["vadjust"] = "V Adjust";
|
||||
capitalize_string_remaps["valign"] = "V Align";
|
||||
capitalize_string_remaps["vector2"] = "Vector2";
|
||||
capitalize_string_remaps["vpn"] = "VPN";
|
||||
capitalize_string_remaps["vram"] = "VRAM";
|
||||
capitalize_string_remaps["vseparation"] = "V Separation";
|
||||
capitalize_string_remaps["vsync"] = "V-Sync";
|
||||
capitalize_string_remaps["wap"] = "WAP";
|
||||
capitalize_string_remaps["webp"] = "WebP";
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import enum
|
||||
import fnmatch
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
|
@ -111,6 +112,9 @@ message_patterns = {
|
|||
re.compile(r'ADD_GROUP\("(?P<message>[^"]+?)", "(?P<prefix>[^"]*?)"\)'): ExtractType.GROUP,
|
||||
re.compile(r'#define (WSC|WSS|WRTC)_\w+ "(?P<message>[^"]+?)"'): ExtractType.PROPERTY_PATH,
|
||||
}
|
||||
theme_property_patterns = {
|
||||
re.compile(r'set_(constant|font|stylebox|color|icon)\("(?P<message>[^"]+)", '): ExtractType.PROPERTY_PATH,
|
||||
}
|
||||
|
||||
|
||||
# See String::camelcase_to_underscore().
|
||||
|
@ -183,6 +187,10 @@ def process_file(f, fname):
|
|||
translator_comment = ""
|
||||
current_group = ""
|
||||
|
||||
patterns = message_patterns
|
||||
if os.path.basename(fname) == "default_theme.cpp":
|
||||
patterns = {**message_patterns, **theme_property_patterns}
|
||||
|
||||
while l:
|
||||
|
||||
# Detect translator comments.
|
||||
|
@ -200,7 +208,7 @@ def process_file(f, fname):
|
|||
translator_comment = translator_comment[:-1] # Remove extra \n at the end.
|
||||
|
||||
if not reading_translator_comment:
|
||||
for pattern, extract_type in message_patterns.items():
|
||||
for pattern, extract_type in patterns.items():
|
||||
for m in pattern.finditer(l):
|
||||
location = os.path.relpath(fname).replace("\\", "/")
|
||||
if line_nb:
|
||||
|
|
|
@ -324,7 +324,7 @@ bool Control::_get(const StringName &p_name, Variant &r_ret) const {
|
|||
void Control::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
Ref<Theme> theme = Theme::get_default();
|
||||
|
||||
p_list->push_back(PropertyInfo(Variant::NIL, "Theme Overrides", PROPERTY_HINT_NONE, "custom_", PROPERTY_USAGE_GROUP));
|
||||
p_list->push_back(PropertyInfo(Variant::NIL, TTRC("Theme Overrides"), PROPERTY_HINT_NONE, "custom_", PROPERTY_USAGE_GROUP));
|
||||
|
||||
{
|
||||
List<StringName> names;
|
||||
|
|
Loading…
Reference in New Issue