From c60d971bc4ab63114c9e30bbe02380a4ae4be443 Mon Sep 17 00:00:00 2001 From: Muhammad Rifqi Priyo Susanto Date: Thu, 5 Oct 2023 22:29:02 +0700 Subject: [PATCH] Move unsupported language list into a separate file (#13865) --- android/app/build.gradle | 7 ++++++- builtin/mainmenu/settings/dlg_settings.lua | 1 + src/CMakeLists.txt | 14 +++----------- src/unsupported_language_list.txt | 8 ++++++++ 4 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 src/unsupported_language_list.txt diff --git a/android/app/build.gradle b/android/app/build.gradle index b268dd3cb..d73fbb766 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -56,6 +56,9 @@ task prepareAssets() { def projRoot = rootDir.parent def gameToCopy = "minetest_game" + // See issue #4638 + def unsupportedLanguages = new File("${projRoot}/src/unsupported_language_list.txt").text.readLines() + doFirst { logger.lifecycle('Preparing assets at {}', assetsFolder) } @@ -86,7 +89,9 @@ task prepareAssets() { } // compile translations - fileTree("${projRoot}/po").include("**/*.po").forEach { poFile -> + fileTree("${projRoot}/po").include("**/*.po").grep { + it.parentFile.name !in unsupportedLanguages + }.forEach { poFile -> def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/" file(moPath).mkdirs() exec { diff --git a/builtin/mainmenu/settings/dlg_settings.lua b/builtin/mainmenu/settings/dlg_settings.lua index 0b8628d81..a397b1fe3 100644 --- a/builtin/mainmenu/settings/dlg_settings.lua +++ b/builtin/mainmenu/settings/dlg_settings.lua @@ -155,6 +155,7 @@ end -- These must not be translated, as they need to show in the local -- language no matter the user's current language. +-- This list must be kept in sync with src/unsupported_language_list.txt. get_setting_info("language").option_labels = { [""] = fgettext_ne("(Use system language)"), --ar = " [ar]", blacklisted diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f14e8ec0..2e0fdc7c1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -660,17 +660,9 @@ if(BUILD_SERVER) endif() endif(BUILD_SERVER) -# Blacklisted locales that don't work. -# see issue #4638 -set(GETTEXT_BLACKLISTED_LOCALES - ar - dv - he - hi - kn - ms_Arab - th -) +# See issue #4638 +FILE(READ "${CMAKE_SOURCE_DIR}/src/unsupported_language_list.txt" GETTEXT_BLACKLISTED_LOCALES) +STRING(REGEX REPLACE "\n" ";" GETTEXT_BLACKLISTED_LOCALES "${GETTEXT_BLACKLISTED_LOCALES}") option(APPLY_LOCALE_BLACKLIST "Use a blacklist to avoid known broken locales" TRUE) diff --git a/src/unsupported_language_list.txt b/src/unsupported_language_list.txt new file mode 100644 index 000000000..20b8445e1 --- /dev/null +++ b/src/unsupported_language_list.txt @@ -0,0 +1,8 @@ +List of languages that are not supported. See issue #4638. +ar +dv +he +hi +kn +ms_Arab +th