mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
[TextServer] Fix ICU data loading and exporting with internationalization/locale/include_text_server_data
setting.
This commit is contained in:
parent
c06df6779a
commit
15dafc49d3
@ -1294,7 +1294,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
|
|||||||
} else {
|
} else {
|
||||||
// Use default text server data.
|
// Use default text server data.
|
||||||
String icu_data_file = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp_icu_data");
|
String icu_data_file = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp_icu_data");
|
||||||
TS->save_support_data(icu_data_file);
|
if (!TS->save_support_data(icu_data_file)) {
|
||||||
|
return ERR_INVALID_DATA;
|
||||||
|
}
|
||||||
Vector<uint8_t> array = FileAccess::get_file_as_bytes(icu_data_file);
|
Vector<uint8_t> array = FileAccess::get_file_as_bytes(icu_data_file);
|
||||||
err = p_func(p_udata, ts_data, array, idx, total, enc_in_filters, enc_ex_filters, key);
|
err = p_func(p_udata, ts_data, array, idx, total, enc_in_filters, enc_ex_filters, key);
|
||||||
DirAccess::remove_file_or_error(icu_data_file);
|
DirAccess::remove_file_or_error(icu_data_file);
|
||||||
|
@ -524,7 +524,11 @@ Error Main::test_setup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (text_driver_idx >= 0) {
|
if (text_driver_idx >= 0) {
|
||||||
TextServerManager::get_singleton()->set_primary_interface(TextServerManager::get_singleton()->get_interface(text_driver_idx));
|
Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(text_driver_idx);
|
||||||
|
TextServerManager::get_singleton()->set_primary_interface(ts);
|
||||||
|
if (ts->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA)) {
|
||||||
|
ts->load_support_data("res://" + ts->get_support_data_filename());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface.");
|
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface.");
|
||||||
}
|
}
|
||||||
@ -2238,7 +2242,11 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (text_driver_idx >= 0) {
|
if (text_driver_idx >= 0) {
|
||||||
TextServerManager::get_singleton()->set_primary_interface(TextServerManager::get_singleton()->get_interface(text_driver_idx));
|
Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(text_driver_idx);
|
||||||
|
TextServerManager::get_singleton()->set_primary_interface(ts);
|
||||||
|
if (ts->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA)) {
|
||||||
|
ts->load_support_data("res://" + ts->get_support_data_filename());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface.");
|
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface.");
|
||||||
}
|
}
|
||||||
|
@ -443,19 +443,11 @@ bool TextServerAdvanced::_load_support_data(const String &p_filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String TextServerAdvanced::_get_support_data_filename() const {
|
String TextServerAdvanced::_get_support_data_filename() const {
|
||||||
#ifdef ICU_STATIC_DATA
|
|
||||||
return _MKSTR(ICU_DATA_NAME);
|
return _MKSTR(ICU_DATA_NAME);
|
||||||
#else
|
|
||||||
return String();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String TextServerAdvanced::_get_support_data_info() const {
|
String TextServerAdvanced::_get_support_data_info() const {
|
||||||
#ifdef ICU_STATIC_DATA
|
|
||||||
return String("ICU break iteration data (") + _MKSTR(ICU_DATA_NAME) + String(").");
|
return String("ICU break iteration data (") + _MKSTR(ICU_DATA_NAME) + String(").");
|
||||||
#else
|
|
||||||
return String();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextServerAdvanced::_save_support_data(const String &p_filename) const {
|
bool TextServerAdvanced::_save_support_data(const String &p_filename) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user