You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
i18n: Add support for translating the class reference
- Parse `.po` files from `doc/translations/*.po` like already done with `editor/translations/*.po`. - Add logic to register a doc translation mapping in `TranslationServer` and `EditorSettings`. - Add `DTR()` to lookup the doc translation mapping (similar to `TTR()`). Strings are automatically dedented and stripped of whitespace to ensure that they would match the translation catalog. - Use `DTR()` to translate relevant strings in `EditorHelp`, `EditorInspector`, `CreateDialog`, `ConnectionsDialog`. - Small simplification to `TranslationLoaderPO`, the path argument was not really meaningful.
This commit is contained in:
@@ -433,7 +433,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->push_color(text_color);
|
||||
class_desc->push_font(doc_bold_font);
|
||||
class_desc->push_indent(1);
|
||||
_add_text(cd.brief_description);
|
||||
_add_text(DTR(cd.brief_description));
|
||||
class_desc->pop();
|
||||
class_desc->pop();
|
||||
class_desc->pop();
|
||||
@@ -458,7 +458,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->push_color(text_color);
|
||||
class_desc->push_font(doc_font);
|
||||
class_desc->push_indent(1);
|
||||
_add_text(cd.description);
|
||||
_add_text(DTR(cd.description));
|
||||
class_desc->pop();
|
||||
class_desc->pop();
|
||||
class_desc->pop();
|
||||
@@ -480,7 +480,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->add_newline();
|
||||
|
||||
for (int i = 0; i < cd.tutorials.size(); i++) {
|
||||
const String link = cd.tutorials[i];
|
||||
const String link = DTR(cd.tutorials[i]);
|
||||
String linktxt = link;
|
||||
const int seppos = linktxt.find("//");
|
||||
if (seppos != -1) {
|
||||
@@ -726,7 +726,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->push_font(doc_font);
|
||||
class_desc->add_text(" ");
|
||||
class_desc->push_color(comment_color);
|
||||
_add_text(cd.theme_properties[i].description);
|
||||
_add_text(DTR(cd.theme_properties[i].description));
|
||||
class_desc->pop();
|
||||
class_desc->pop();
|
||||
}
|
||||
@@ -796,7 +796,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->push_font(doc_font);
|
||||
class_desc->push_color(comment_color);
|
||||
class_desc->push_indent(1);
|
||||
_add_text(cd.signals[i].description);
|
||||
_add_text(DTR(cd.signals[i].description));
|
||||
class_desc->pop(); // indent
|
||||
class_desc->pop();
|
||||
class_desc->pop(); // font
|
||||
@@ -893,7 +893,7 @@ void EditorHelp::_update_doc() {
|
||||
//class_desc->add_text(" ");
|
||||
class_desc->push_indent(1);
|
||||
class_desc->push_color(comment_color);
|
||||
_add_text(enum_list[i].description);
|
||||
_add_text(DTR(enum_list[i].description));
|
||||
class_desc->pop();
|
||||
class_desc->pop();
|
||||
class_desc->pop(); // indent
|
||||
@@ -959,7 +959,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->push_font(doc_font);
|
||||
class_desc->push_indent(1);
|
||||
class_desc->push_color(comment_color);
|
||||
_add_text(constants[i].description);
|
||||
_add_text(DTR(constants[i].description));
|
||||
class_desc->pop();
|
||||
class_desc->pop();
|
||||
class_desc->pop(); // indent
|
||||
@@ -1070,7 +1070,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->push_font(doc_font);
|
||||
class_desc->push_indent(1);
|
||||
if (cd.properties[i].description.strip_edges() != String()) {
|
||||
_add_text(cd.properties[i].description);
|
||||
_add_text(DTR(cd.properties[i].description));
|
||||
} else {
|
||||
class_desc->add_image(get_icon("Error", "EditorIcons"));
|
||||
class_desc->add_text(" ");
|
||||
@@ -1123,7 +1123,7 @@ void EditorHelp::_update_doc() {
|
||||
class_desc->push_font(doc_font);
|
||||
class_desc->push_indent(1);
|
||||
if (methods_filtered[i].description.strip_edges() != String()) {
|
||||
_add_text(methods_filtered[i].description);
|
||||
_add_text(DTR(methods_filtered[i].description));
|
||||
} else {
|
||||
class_desc->add_image(get_icon("Error", "EditorIcons"));
|
||||
class_desc->add_text(" ");
|
||||
@@ -1449,7 +1449,6 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
|
||||
}
|
||||
|
||||
void EditorHelp::_add_text(const String &p_bbcode) {
|
||||
|
||||
_add_text_to_rt(p_bbcode, class_desc);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user