Skip to content

Commit

Permalink
Merge pull request #39118 from akien-mga/doc-l10n-propertyselector
Browse files Browse the repository at this point in the history
Use translated docs in PropertySelector
  • Loading branch information
akien-mga authored May 28, 2020
2 parents 055624d + a16031b commit 6d63974
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
7 changes: 4 additions & 3 deletions core/ustring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4338,13 +4338,14 @@ String TTR(const String &p_text) {
}

String DTR(const String &p_text) {
// Comes straight from the XML, so remove indentation and any trailing whitespace.
const String text = p_text.dedent().strip_edges();

if (TranslationServer::get_singleton()) {
// Comes straight from the XML, so remove indentation and any trailing whitespace.
const String text = p_text.dedent().strip_edges();
return TranslationServer::get_singleton()->doc_translate(text);
}

return p_text;
return text;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion editor/connections_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ void ConnectionsDock::update_tree() {
while (F && descr == String()) {
for (int i = 0; i < F->get().signals.size(); i++) {
if (F->get().signals[i].name == signal_name.operator String()) {
descr = DTR(F->get().signals[i].description.strip_edges());
descr = DTR(F->get().signals[i].description);
break;
}
}
Expand Down
8 changes: 4 additions & 4 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1583,9 +1583,9 @@ void EditorInspector::update_tree() {
DocData *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(type2);
if (E) {
descr = E->get().brief_description;
descr = DTR(E->get().brief_description);
}
class_descr_cache[type2] = DTR(descr);
class_descr_cache[type2] = descr;
}

category->set_tooltip(p.name + "::" + (class_descr_cache[type2] == "" ? "" : class_descr_cache[type2]));
Expand Down Expand Up @@ -1755,7 +1755,7 @@ void EditorInspector::update_tree() {
while (F && descr == String()) {
for (int i = 0; i < F->get().properties.size(); i++) {
if (F->get().properties[i].name == propname.operator String()) {
descr = DTR(F->get().properties[i].description.strip_edges());
descr = DTR(F->get().properties[i].description);
break;
}
}
Expand All @@ -1765,7 +1765,7 @@ void EditorInspector::update_tree() {
// Likely a theme property.
for (int i = 0; i < F->get().theme_properties.size(); i++) {
if (F->get().theme_properties[i].name == slices[1]) {
descr = DTR(F->get().theme_properties[i].description.strip_edges());
descr = DTR(F->get().theme_properties[i].description);
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions editor/property_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void PropertySelector::_item_selected() {
if (E) {
for (int i = 0; i < E->get().properties.size(); i++) {
if (E->get().properties[i].name == name) {
text = E->get().properties[i].description;
text = DTR(E->get().properties[i].description);
}
}
}
Expand All @@ -372,7 +372,7 @@ void PropertySelector::_item_selected() {
if (E) {
for (int i = 0; i < E->get().methods.size(); i++) {
if (E->get().methods[i].name == name) {
text = E->get().methods[i].description;
text = DTR(E->get().methods[i].description);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions modules/visual_script/visual_script_property_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ void VisualScriptPropertySelector::_item_selected() {
if (E) {
for (int i = 0; i < E->get().properties.size(); i++) {
if (E->get().properties[i].name == name) {
text = E->get().properties[i].description;
text = DTR(E->get().properties[i].description);
}
}
}
Expand All @@ -461,7 +461,7 @@ void VisualScriptPropertySelector::_item_selected() {
if (C) {
for (int i = 0; i < C->get().methods.size(); i++) {
if (C->get().methods[i].name == name) {
text = C->get().methods[i].description;
text = DTR(C->get().methods[i].description);
}
}
}
Expand All @@ -473,7 +473,7 @@ void VisualScriptPropertySelector::_item_selected() {
for (int i = 0; i < T->get().methods.size(); i++) {
Vector<String> functions = name.rsplit("/", false, 1);
if (T->get().methods[i].name == functions[functions.size() - 1]) {
text = T->get().methods[i].description;
text = DTR(T->get().methods[i].description);
}
}
}
Expand All @@ -492,7 +492,7 @@ void VisualScriptPropertySelector::_item_selected() {
if (typecast_node.is_valid()) {
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(typecast_node->get_class_name());
if (F) {
text = F->get().description;
text = DTR(F->get().description);
}
}

Expand All @@ -502,7 +502,7 @@ void VisualScriptPropertySelector::_item_selected() {
if (F) {
for (int i = 0; i < F->get().constants.size(); i++) {
if (F->get().constants[i].value.to_int() == int(builtin_node->get_func())) {
text = F->get().constants[i].description;
text = DTR(F->get().constants[i].description);
}
}
}
Expand Down

0 comments on commit 6d63974

Please sign in to comment.