Improve POT Generation dialog

* Avoid "property not found" warnings when adding a file for the first
  time.
* When no file is added, disable the Generate POT button instead of
  printing a warning.
This commit is contained in:
Haoyu Qiu
2023-03-02 14:38:59 +08:00
parent 61d2c85511
commit 584136271c
4 changed files with 18 additions and 16 deletions

View File

@ -55,7 +55,9 @@ void POTGenerator::_print_all_translation_strings() {
#endif
void POTGenerator::generate_pot(const String &p_file) {
if (!ProjectSettings::get_singleton()->has_setting("internationalization/locale/translations_pot_files")) {
Vector<String> files = GLOBAL_GET("internationalization/locale/translations_pot_files");
if (files.is_empty()) {
WARN_PRINT("No files selected for POT generation.");
return;
}
@ -63,8 +65,6 @@ void POTGenerator::generate_pot(const String &p_file) {
// Clear all_translation_strings of the previous round.
all_translation_strings.clear();
Vector<String> files = GLOBAL_GET("internationalization/locale/translations_pot_files");
// Collect all translatable strings according to files order in "POT Generation" setting.
for (int i = 0; i < files.size(); i++) {
Vector<String> msgids;