You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Make --doctool locale aware
* Adds `indent(prefix)` to `String`
* Moves the loading of tool/doc translation into
`editor/editor_translation.{h,cpp}`
* Makes use of doc translation when generating XML class references, and
setup the translation locale based on `-l LOCALE` CLI parameter.
The XML class reference won't be translated if `-l LOCALE` parameter is
not given, or when it's `-l en`.
This commit is contained in:
@@ -76,6 +76,7 @@
|
||||
#include "editor/doc/doc_data_class_path.gen.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_translation.h"
|
||||
#include "editor/progress_dialog.h"
|
||||
#include "editor/project_manager.h"
|
||||
#ifndef NO_EDITOR_SPLASH
|
||||
@@ -1523,7 +1524,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
|
||||
VisualServer::get_singleton()->callbacks_register(visual_server_callbacks);
|
||||
|
||||
_start_success = true;
|
||||
locale = String();
|
||||
|
||||
ClassDB::set_current_api(ClassDB::API_NONE); //no more api is registered at this point
|
||||
|
||||
@@ -1631,6 +1631,11 @@ bool Main::start() {
|
||||
if (doc_tool_path != "") {
|
||||
Engine::get_singleton()->set_editor_hint(true); // Needed to instance editor-only classes for their default values
|
||||
|
||||
// Translate the class reference only when `-l LOCALE` parameter is given.
|
||||
if (!locale.empty() && locale != "en") {
|
||||
load_doc_translations(locale);
|
||||
}
|
||||
|
||||
{
|
||||
DirAccessRef da = DirAccess::open(doc_tool_path);
|
||||
ERR_FAIL_COND_V_MSG(!da, false, "Argument supplied to --doctool must be a valid directory path.");
|
||||
|
||||
Reference in New Issue
Block a user