2022-03-03 18:25:11 +08:00
|
|
|
/**************************************************************************/
|
|
|
|
/* editor_property_name_processor.cpp */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
#include "editor_property_name_processor.h"
|
|
|
|
|
2022-12-27 10:58:01 +08:00
|
|
|
#include "core/string/translation.h"
|
2022-03-03 18:25:11 +08:00
|
|
|
#include "editor_settings.h"
|
|
|
|
|
|
|
|
EditorPropertyNameProcessor *EditorPropertyNameProcessor::singleton = nullptr;
|
|
|
|
|
2022-03-23 09:46:59 +08:00
|
|
|
EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_default_inspector_style() {
|
2023-05-10 18:03:30 +08:00
|
|
|
if (!EditorSettings::get_singleton()) {
|
|
|
|
return STYLE_CAPITALIZED;
|
|
|
|
}
|
2022-03-23 09:46:59 +08:00
|
|
|
const Style style = (Style)EDITOR_GET("interface/inspector/default_property_name_style").operator int();
|
|
|
|
if (style == STYLE_LOCALIZED && !is_localization_available()) {
|
|
|
|
return STYLE_CAPITALIZED;
|
|
|
|
}
|
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
|
|
|
EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_settings_style() {
|
2023-05-10 18:03:30 +08:00
|
|
|
if (!EditorSettings::get_singleton()) {
|
|
|
|
return STYLE_LOCALIZED;
|
|
|
|
}
|
2022-03-23 09:46:59 +08:00
|
|
|
const bool translate = EDITOR_GET("interface/editor/localize_settings");
|
|
|
|
return translate ? STYLE_LOCALIZED : STYLE_CAPITALIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_tooltip_style(Style p_style) {
|
|
|
|
return p_style == STYLE_LOCALIZED ? STYLE_CAPITALIZED : STYLE_LOCALIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorPropertyNameProcessor::is_localization_available() {
|
2023-05-10 18:03:30 +08:00
|
|
|
if (!EditorSettings::get_singleton()) {
|
|
|
|
return false;
|
|
|
|
}
|
2022-03-23 09:46:59 +08:00
|
|
|
const Vector<String> forbidden = String("en").split(",");
|
|
|
|
return forbidden.find(EDITOR_GET("interface/editor/editor_language")) == -1;
|
|
|
|
}
|
|
|
|
|
2022-03-03 18:25:11 +08:00
|
|
|
String EditorPropertyNameProcessor::_capitalize_name(const String &p_name) const {
|
2022-05-13 21:04:37 +08:00
|
|
|
HashMap<String, String>::ConstIterator cached = capitalize_string_cache.find(p_name);
|
2022-03-18 00:27:20 +08:00
|
|
|
if (cached) {
|
2022-05-13 21:04:37 +08:00
|
|
|
return cached->value;
|
2022-03-18 00:27:20 +08:00
|
|
|
}
|
2022-03-03 18:25:11 +08:00
|
|
|
|
2022-03-18 00:27:20 +08:00
|
|
|
Vector<String> parts = p_name.split("_", false);
|
|
|
|
for (int i = 0; i < parts.size(); i++) {
|
2022-11-25 18:54:37 +08:00
|
|
|
// Articles/conjunctions/prepositions which should only be capitalized when not at beginning and end.
|
|
|
|
if (i > 0 && i + 1 < parts.size() && stop_words.find(parts[i]) != -1) {
|
2022-11-10 00:09:31 +08:00
|
|
|
continue;
|
|
|
|
}
|
2022-05-13 21:04:37 +08:00
|
|
|
HashMap<String, String>::ConstIterator remap = capitalize_string_remaps.find(parts[i]);
|
2022-03-18 00:27:20 +08:00
|
|
|
if (remap) {
|
2022-05-13 21:04:37 +08:00
|
|
|
parts.write[i] = remap->value;
|
2022-03-18 00:27:20 +08:00
|
|
|
} else {
|
|
|
|
parts.write[i] = parts[i].capitalize();
|
|
|
|
}
|
2022-03-03 18:25:11 +08:00
|
|
|
}
|
2022-03-18 00:27:20 +08:00
|
|
|
const String capitalized = String(" ").join(parts);
|
2022-03-03 18:25:11 +08:00
|
|
|
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_cache[p_name] = capitalized;
|
|
|
|
return capitalized;
|
2022-03-03 18:25:11 +08:00
|
|
|
}
|
|
|
|
|
2023-10-05 21:12:10 +08:00
|
|
|
StringName EditorPropertyNameProcessor::_get_context(const String &p_name, const String &p_property, const StringName &p_class) const {
|
|
|
|
if (p_property.is_empty() && p_class == StringName()) {
|
|
|
|
return StringName();
|
|
|
|
}
|
|
|
|
const HashMap<String, StringName> *context_map = translation_contexts.getptr(p_name);
|
|
|
|
if (context_map == nullptr) {
|
|
|
|
return StringName();
|
|
|
|
}
|
|
|
|
// It's expected that full property path is enough to distinguish between usages.
|
|
|
|
// In case a class name is needed, all usages should be prefixed with the class name.
|
|
|
|
const StringName *context = context_map->getptr(p_property);
|
|
|
|
if (context == nullptr && p_class != StringName()) {
|
|
|
|
context = context_map->getptr(String(p_class) + "::" + p_property);
|
|
|
|
}
|
|
|
|
if (context == nullptr) {
|
|
|
|
return StringName();
|
|
|
|
}
|
|
|
|
return *context;
|
|
|
|
}
|
|
|
|
|
|
|
|
String EditorPropertyNameProcessor::process_name(const String &p_name, Style p_style, const String &p_property, const StringName &p_class) const {
|
2022-03-23 09:46:59 +08:00
|
|
|
switch (p_style) {
|
|
|
|
case STYLE_RAW: {
|
|
|
|
return p_name;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case STYLE_CAPITALIZED: {
|
|
|
|
return _capitalize_name(p_name);
|
|
|
|
} break;
|
2022-03-03 18:25:11 +08:00
|
|
|
|
2022-03-23 09:46:59 +08:00
|
|
|
case STYLE_LOCALIZED: {
|
2022-12-27 10:58:01 +08:00
|
|
|
const String capitalized = _capitalize_name(p_name);
|
|
|
|
if (TranslationServer::get_singleton()) {
|
2023-10-05 21:12:10 +08:00
|
|
|
return TranslationServer::get_singleton()->property_translate(capitalized, _get_context(p_name, p_property, p_class));
|
2022-12-27 10:58:01 +08:00
|
|
|
}
|
|
|
|
return capitalized;
|
2022-03-23 09:46:59 +08:00
|
|
|
} break;
|
2022-03-03 18:25:11 +08:00
|
|
|
}
|
2022-03-23 09:46:59 +08:00
|
|
|
ERR_FAIL_V_MSG(p_name, "Unexpected property name style.");
|
2022-03-03 18:25:11 +08:00
|
|
|
}
|
|
|
|
|
2022-12-27 10:58:01 +08:00
|
|
|
String EditorPropertyNameProcessor::translate_group_name(const String &p_name) const {
|
|
|
|
if (TranslationServer::get_singleton()) {
|
|
|
|
return TranslationServer::get_singleton()->property_translate(p_name);
|
|
|
|
}
|
|
|
|
return p_name;
|
|
|
|
}
|
|
|
|
|
2022-03-03 18:25:11 +08:00
|
|
|
EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
|
|
|
|
ERR_FAIL_COND(singleton != nullptr);
|
|
|
|
singleton = this;
|
|
|
|
|
2022-12-27 10:58:01 +08:00
|
|
|
// The following initialization is parsed by the l10n extraction script with a regex.
|
2022-03-03 18:25:11 +08:00
|
|
|
// The map name and value definition format should be kept synced with the regex.
|
2022-12-27 10:58:01 +08:00
|
|
|
// https://github.com/godotengine/godot-editor-l10n/blob/main/scripts/common.py
|
2022-03-03 18:25:11 +08:00
|
|
|
capitalize_string_remaps["2d"] = "2D";
|
|
|
|
capitalize_string_remaps["3d"] = "3D";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["aa"] = "AA";
|
|
|
|
capitalize_string_remaps["aabb"] = "AABB";
|
|
|
|
capitalize_string_remaps["adb"] = "ADB";
|
|
|
|
capitalize_string_remaps["ao"] = "AO";
|
2022-08-09 23:51:43 +08:00
|
|
|
capitalize_string_remaps["api"] = "API";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["apk"] = "APK";
|
2023-03-09 16:41:52 +08:00
|
|
|
capitalize_string_remaps["arm32"] = "arm32";
|
|
|
|
capitalize_string_remaps["arm64"] = "arm64";
|
2022-03-23 09:46:59 +08:00
|
|
|
capitalize_string_remaps["arm64-v8a"] = "arm64-v8a";
|
|
|
|
capitalize_string_remaps["armeabi-v7a"] = "armeabi-v7a";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["arvr"] = "ARVR";
|
2023-01-25 19:17:11 +08:00
|
|
|
capitalize_string_remaps["astc"] = "ASTC";
|
2023-03-15 00:47:36 +08:00
|
|
|
capitalize_string_remaps["bbcode"] = "BBCode";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["bg"] = "BG";
|
2022-05-24 06:03:34 +08:00
|
|
|
capitalize_string_remaps["bidi"] = "BiDi";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["bp"] = "BP";
|
|
|
|
capitalize_string_remaps["bpc"] = "BPC";
|
2022-08-02 21:35:29 +08:00
|
|
|
capitalize_string_remaps["bpm"] = "BPM";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["bptc"] = "BPTC";
|
|
|
|
capitalize_string_remaps["bvh"] = "BVH";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["ca"] = "CA";
|
2023-02-12 15:25:39 +08:00
|
|
|
capitalize_string_remaps["ccdik"] = "CCDIK";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["cd"] = "CD";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["cpu"] = "CPU";
|
|
|
|
capitalize_string_remaps["csg"] = "CSG";
|
2023-12-13 04:36:57 +08:00
|
|
|
capitalize_string_remaps["d3d12"] = "D3D12";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["db"] = "dB";
|
|
|
|
capitalize_string_remaps["dof"] = "DoF";
|
|
|
|
capitalize_string_remaps["dpi"] = "DPI";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["dtls"] = "DTLS";
|
2022-04-01 11:04:20 +08:00
|
|
|
capitalize_string_remaps["eol"] = "EOL";
|
2022-03-30 18:21:46 +08:00
|
|
|
capitalize_string_remaps["erp"] = "ERP";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["etc2"] = "ETC2";
|
2023-02-12 15:25:39 +08:00
|
|
|
capitalize_string_remaps["fabrik"] = "FABRIK";
|
2022-03-29 15:00:43 +08:00
|
|
|
capitalize_string_remaps["fbx"] = "FBX";
|
2022-04-01 11:04:20 +08:00
|
|
|
capitalize_string_remaps["fbx2gltf"] = "FBX2glTF";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["fft"] = "FFT";
|
2022-04-01 11:04:20 +08:00
|
|
|
capitalize_string_remaps["fg"] = "FG";
|
2022-05-24 06:03:34 +08:00
|
|
|
capitalize_string_remaps["filesystem"] = "FileSystem";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["fov"] = "FOV";
|
|
|
|
capitalize_string_remaps["fps"] = "FPS";
|
|
|
|
capitalize_string_remaps["fs"] = "FS";
|
|
|
|
capitalize_string_remaps["fsr"] = "FSR";
|
|
|
|
capitalize_string_remaps["fxaa"] = "FXAA";
|
|
|
|
capitalize_string_remaps["gdscript"] = "GDScript";
|
|
|
|
capitalize_string_remaps["ggx"] = "GGX";
|
|
|
|
capitalize_string_remaps["gi"] = "GI";
|
2022-11-10 00:09:31 +08:00
|
|
|
capitalize_string_remaps["gl"] = "GL";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["glb"] = "GLB";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["gles2"] = "GLES2";
|
|
|
|
capitalize_string_remaps["gles3"] = "GLES3";
|
2023-02-12 15:25:39 +08:00
|
|
|
capitalize_string_remaps["gltf"] = "glTF";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["gpu"] = "GPU";
|
|
|
|
capitalize_string_remaps["gui"] = "GUI";
|
2022-03-30 18:21:46 +08:00
|
|
|
capitalize_string_remaps["guid"] = "GUID";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["hdr"] = "HDR";
|
|
|
|
capitalize_string_remaps["hidpi"] = "hiDPI";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["hipass"] = "High-pass";
|
2022-04-01 11:04:20 +08:00
|
|
|
capitalize_string_remaps["hl"] = "HL";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["hsv"] = "HSV";
|
2022-03-30 18:21:46 +08:00
|
|
|
capitalize_string_remaps["html"] = "HTML";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["http"] = "HTTP";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["id"] = "ID";
|
2022-11-10 00:09:31 +08:00
|
|
|
capitalize_string_remaps["ids"] = "IDs";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["igd"] = "IGD";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["ik"] = "IK";
|
|
|
|
capitalize_string_remaps["image@2x"] = "Image @2x";
|
|
|
|
capitalize_string_remaps["image@3x"] = "Image @3x";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["iod"] = "IOD";
|
2022-05-24 06:03:34 +08:00
|
|
|
capitalize_string_remaps["ios"] = "iOS";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["ip"] = "IP";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["ipad"] = "iPad";
|
|
|
|
capitalize_string_remaps["iphone"] = "iPhone";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["ipv6"] = "IPv6";
|
2022-03-23 09:46:59 +08:00
|
|
|
capitalize_string_remaps["ir"] = "IR";
|
2022-03-30 18:21:46 +08:00
|
|
|
capitalize_string_remaps["itunes"] = "iTunes";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["jit"] = "JIT";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["k1"] = "K1";
|
|
|
|
capitalize_string_remaps["k2"] = "K2";
|
2022-03-18 02:42:24 +08:00
|
|
|
capitalize_string_remaps["kb"] = "(KB)"; // Unit.
|
2022-08-12 19:03:28 +08:00
|
|
|
capitalize_string_remaps["lcd"] = "LCD";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["ldr"] = "LDR";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["lod"] = "LOD";
|
2023-02-12 15:25:39 +08:00
|
|
|
capitalize_string_remaps["lods"] = "LODs";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["lowpass"] = "Low-pass";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["macos"] = "macOS";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["mb"] = "(MB)"; // Unit.
|
2022-06-25 04:24:21 +08:00
|
|
|
capitalize_string_remaps["mjpeg"] = "MJPEG";
|
2022-03-23 09:46:59 +08:00
|
|
|
capitalize_string_remaps["mms"] = "MMS";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["ms"] = "(ms)"; // Unit
|
2022-05-24 06:03:34 +08:00
|
|
|
capitalize_string_remaps["msaa"] = "MSAA";
|
|
|
|
capitalize_string_remaps["msdf"] = "MSDF";
|
2022-03-18 15:01:08 +08:00
|
|
|
// Not used for now as AudioEffectReverb has a `msec` property.
|
|
|
|
//capitalize_string_remaps["msec"] = "(msec)"; // Unit.
|
2022-04-25 00:08:36 +08:00
|
|
|
capitalize_string_remaps["navmesh"] = "NavMesh";
|
2022-05-24 06:03:34 +08:00
|
|
|
capitalize_string_remaps["nfc"] = "NFC";
|
2024-01-12 20:45:20 +08:00
|
|
|
capitalize_string_remaps["oidn"] = "OIDN";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["ok"] = "OK";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["opengl"] = "OpenGL";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["opentype"] = "OpenType";
|
|
|
|
capitalize_string_remaps["openxr"] = "OpenXR";
|
2022-08-09 23:51:43 +08:00
|
|
|
capitalize_string_remaps["osslsigncode"] = "osslsigncode";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["pck"] = "PCK";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["png"] = "PNG";
|
2022-03-18 02:42:24 +08:00
|
|
|
capitalize_string_remaps["po2"] = "(Power of 2)"; // Unit.
|
2023-03-09 16:41:52 +08:00
|
|
|
capitalize_string_remaps["ppc32"] = "ppc32";
|
|
|
|
capitalize_string_remaps["ppc64"] = "ppc64";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["pvrtc"] = "PVRTC";
|
2022-05-24 06:03:34 +08:00
|
|
|
capitalize_string_remaps["pvs"] = "PVS";
|
2022-08-09 23:51:43 +08:00
|
|
|
capitalize_string_remaps["rcedit"] = "rcedit";
|
|
|
|
capitalize_string_remaps["rcodesign"] = "rcodesign";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["rgb"] = "RGB";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["rid"] = "RID";
|
|
|
|
capitalize_string_remaps["rmb"] = "RMB";
|
|
|
|
capitalize_string_remaps["rpc"] = "RPC";
|
2023-03-09 16:41:52 +08:00
|
|
|
capitalize_string_remaps["rv64"] = "rv64";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["s3tc"] = "S3TC";
|
2022-05-08 15:46:53 +08:00
|
|
|
capitalize_string_remaps["scp"] = "SCP";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["sdf"] = "SDF";
|
|
|
|
capitalize_string_remaps["sdfgi"] = "SDFGI";
|
|
|
|
capitalize_string_remaps["sdk"] = "SDK";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["sec"] = "(sec)"; // Unit.
|
2022-08-09 23:51:43 +08:00
|
|
|
capitalize_string_remaps["signtool"] = "signtool";
|
2022-03-23 09:46:59 +08:00
|
|
|
capitalize_string_remaps["sms"] = "SMS";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["srgb"] = "sRGB";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["ssao"] = "SSAO";
|
|
|
|
capitalize_string_remaps["ssh"] = "SSH";
|
|
|
|
capitalize_string_remaps["ssil"] = "SSIL";
|
|
|
|
capitalize_string_remaps["ssl"] = "SSL";
|
2022-05-13 04:03:16 +08:00
|
|
|
capitalize_string_remaps["sss"] = "SSS";
|
2022-03-18 02:42:24 +08:00
|
|
|
capitalize_string_remaps["stderr"] = "stderr";
|
|
|
|
capitalize_string_remaps["stdout"] = "stdout";
|
2022-04-01 11:04:20 +08:00
|
|
|
capitalize_string_remaps["sv"] = "SV";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["svg"] = "SVG";
|
2022-06-12 06:27:56 +08:00
|
|
|
capitalize_string_remaps["taa"] = "TAA";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["tcp"] = "TCP";
|
2023-06-09 20:27:46 +08:00
|
|
|
capitalize_string_remaps["textfile"] = "TextFile";
|
2022-11-10 00:09:31 +08:00
|
|
|
capitalize_string_remaps["tls"] = "TLS";
|
2024-02-02 17:47:57 +08:00
|
|
|
capitalize_string_remaps["tv"] = "TV";
|
2022-03-18 02:42:24 +08:00
|
|
|
capitalize_string_remaps["ui"] = "UI";
|
2019-07-18 19:34:33 +08:00
|
|
|
capitalize_string_remaps["uri"] = "URI";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["url"] = "URL";
|
|
|
|
capitalize_string_remaps["urls"] = "URLs";
|
2023-08-07 16:37:41 +08:00
|
|
|
capitalize_string_remaps["us"] = U"(µs)"; // Unit.
|
2022-03-30 18:21:46 +08:00
|
|
|
capitalize_string_remaps["usb"] = "USB";
|
2023-08-07 16:37:41 +08:00
|
|
|
capitalize_string_remaps["usec"] = U"(µsec)"; // Unit.
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["uuid"] = "UUID";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["uv"] = "UV";
|
|
|
|
capitalize_string_remaps["uv1"] = "UV1";
|
|
|
|
capitalize_string_remaps["uv2"] = "UV2";
|
|
|
|
capitalize_string_remaps["vector2"] = "Vector2";
|
2022-03-23 09:46:59 +08:00
|
|
|
capitalize_string_remaps["vpn"] = "VPN";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["vram"] = "VRAM";
|
2022-11-10 00:09:31 +08:00
|
|
|
capitalize_string_remaps["vrs"] = "VRS";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["vsync"] = "V-Sync";
|
2022-03-23 09:46:59 +08:00
|
|
|
capitalize_string_remaps["wap"] = "WAP";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["webp"] = "WebP";
|
|
|
|
capitalize_string_remaps["webrtc"] = "WebRTC";
|
|
|
|
capitalize_string_remaps["websocket"] = "WebSocket";
|
2022-08-09 23:51:43 +08:00
|
|
|
capitalize_string_remaps["wine"] = "wine";
|
2022-03-20 20:21:00 +08:00
|
|
|
capitalize_string_remaps["wifi"] = "Wi-Fi";
|
2022-03-23 09:46:59 +08:00
|
|
|
capitalize_string_remaps["x86"] = "x86";
|
2023-03-09 16:41:52 +08:00
|
|
|
capitalize_string_remaps["x86_32"] = "x86_32";
|
|
|
|
capitalize_string_remaps["x86_64"] = "x86_64";
|
2022-03-18 00:27:20 +08:00
|
|
|
capitalize_string_remaps["xr"] = "XR";
|
2022-11-10 00:09:31 +08:00
|
|
|
capitalize_string_remaps["xray"] = "X-Ray";
|
2022-03-18 02:42:24 +08:00
|
|
|
capitalize_string_remaps["xy"] = "XY";
|
|
|
|
capitalize_string_remaps["xz"] = "XZ";
|
2022-03-18 15:01:08 +08:00
|
|
|
capitalize_string_remaps["yz"] = "YZ";
|
2022-11-10 00:09:31 +08:00
|
|
|
|
|
|
|
// Articles, conjunctions, prepositions.
|
2022-12-27 10:58:01 +08:00
|
|
|
// The following initialization is parsed in `editor/translations/scripts/common.py` with a regex.
|
2022-11-25 18:54:37 +08:00
|
|
|
// The word definition format should be kept synced with the regex.
|
2022-11-10 00:09:31 +08:00
|
|
|
stop_words = LocalVector<String>({
|
|
|
|
"a",
|
|
|
|
"an",
|
|
|
|
"and",
|
|
|
|
"as",
|
|
|
|
"at",
|
|
|
|
"by",
|
|
|
|
"for",
|
|
|
|
"in",
|
|
|
|
"not",
|
|
|
|
"of",
|
|
|
|
"on",
|
|
|
|
"or",
|
|
|
|
"over",
|
|
|
|
"per",
|
|
|
|
"the",
|
|
|
|
"then",
|
|
|
|
"to",
|
|
|
|
});
|
2023-10-05 21:12:10 +08:00
|
|
|
|
|
|
|
// Translation context associated with a name.
|
|
|
|
// The second key is either:
|
|
|
|
// - `full/property/path`
|
|
|
|
// - `Class::full/property/path`
|
|
|
|
// In case a class name is needed to distinguish between usages, all usages should use the second format.
|
|
|
|
//
|
|
|
|
// The following initialization is parsed in `editor/translations/scripts/common.py` with a regex.
|
|
|
|
// The map name and value definition format should be kept synced with the regex.
|
|
|
|
translation_contexts["force"]["constant_force"] = "Physics";
|
|
|
|
translation_contexts["force"]["force/8_bit"] = "Enforce";
|
|
|
|
translation_contexts["force"]["force/mono"] = "Enforce";
|
|
|
|
translation_contexts["force"]["force/max_rate"] = "Enforce";
|
|
|
|
translation_contexts["force"]["force/max_rate_hz"] = "Enforce";
|
|
|
|
translation_contexts["normal"]["theme_override_styles/normal"] = "Ordinary";
|
|
|
|
translation_contexts["normal"]["TextureButton::texture_normal"] = "Ordinary";
|
|
|
|
translation_contexts["normal"]["Decal::texture_normal"] = "Geometry";
|
|
|
|
translation_contexts["normal"]["detail_normal"] = "Geometry";
|
|
|
|
translation_contexts["normal"]["normal"] = "Geometry";
|
2022-03-03 18:25:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
EditorPropertyNameProcessor::~EditorPropertyNameProcessor() {
|
|
|
|
singleton = nullptr;
|
|
|
|
}
|