diff options
author | hop311 <hop3114@gmail.com> | 2023-10-29 15:11:24 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-11-07 23:02:34 +0100 |
commit | 47fff276966d42cba6a2df9093348a5e20a37159 (patch) | |
tree | 556707348d57b81f91627bb8fda5989a305c0d21 /extension/src/openvic-extension/LoadLocalisation.cpp | |
parent | 9304fd4e109c27a7dfb487a15c9a52c4055ee485 (diff) |
Clang-format formatting (with manual cleanup)
Diffstat (limited to 'extension/src/openvic-extension/LoadLocalisation.cpp')
-rw-r--r-- | extension/src/openvic-extension/LoadLocalisation.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/extension/src/openvic-extension/LoadLocalisation.cpp b/extension/src/openvic-extension/LoadLocalisation.cpp index 6ed92fd..ee90633 100644 --- a/extension/src/openvic-extension/LoadLocalisation.cpp +++ b/extension/src/openvic-extension/LoadLocalisation.cpp @@ -32,7 +32,7 @@ LoadLocalisation::~LoadLocalisation() { singleton = nullptr; } -Error LoadLocalisation::_load_file_into_translation(String const& file_path, Ref<Translation> translation) const { +Error LoadLocalisation::_load_file(String const& file_path, Ref<Translation> translation) const { const Ref<FileAccess> file = FileAccess::open(file_path, FileAccess::ModeFlags::READ); Error err = FileAccess::get_open_error(); if (err != OK || file.is_null()) { @@ -46,10 +46,14 @@ Error LoadLocalisation::_load_file_into_translation(String const& file_path, Ref line_number++; if (line.size() < 2 || line[0].is_empty() || line[1].is_empty()) { if (!line[0].is_empty()) { - UtilityFunctions::push_warning("Key \"", line[0], "\" missing value on line ", line_number, " in file: ", file_path); + UtilityFunctions::push_warning( + "Key \"", line[0], "\" missing value on line ", line_number, " in file: ", file_path + ); err = FAILED; } else if (line.size() >= 2 && !line[1].is_empty()) { - UtilityFunctions::push_warning("Value \"", line[1], "\" missing key on line ", line_number, " in file: ", file_path); + UtilityFunctions::push_warning( + "Value \"", line[1], "\" missing key on line ", line_number, " in file: ", file_path + ); err = FAILED; } continue; @@ -75,7 +79,7 @@ Ref<Translation> LoadLocalisation::_get_translation(String const& locale) const } Error LoadLocalisation::load_file(String const& file_path, String const& locale) const { - return _load_file_into_translation(file_path, _get_translation(locale)); + return _load_file(file_path, _get_translation(locale)); } /* REQUIREMENTS @@ -101,7 +105,7 @@ Error LoadLocalisation::load_locale_dir(String const& dir_path, String const& lo Error err = OK; for (String const& file_name : files) { if (file_name.get_extension().to_lower() == "csv") { - if (_load_file_into_translation(dir_path.path_join(file_name), translation) != OK) { + if (_load_file(dir_path.path_join(file_name), translation) != OK) { err = FAILED; } } @@ -153,8 +157,10 @@ bool LoadLocalisation::add_message(std::string_view key, Dataloader::locale_t lo if (0) { const StringName old_localisation = translation->get_message(godot_key); if (!old_localisation.is_empty()) { - UtilityFunctions::push_warning("Changing translation ", godot_key, " (", Dataloader::locale_names[locale], ") from \"", - old_localisation, "\" to \"", godot_localisation, "\""); + UtilityFunctions::push_warning( + "Changing translation ", godot_key, " (", Dataloader::locale_names[locale], ") from \"", + old_localisation, "\" to \"", godot_localisation, "\"" + ); } } translation->add_message(godot_key, godot_localisation); |