[gimp/wip/Jehan/issue-7386-fix-Kabyle-showing-English: 3/3] Issue #7386: fix languages non-provided by InnoSetup showing as English.




commit 47ba11056ff5f6c471eeee3bf60fe2cdd332f8d5
Author: Jehan <jehan girinstud io>
Date:   Sun Jul 31 14:22:12 2022 +0200

    Issue #7386: fix languages non-provided by InnoSetup showing as English.
    
    The language files provided by the InnoSetup project (either the main
    ones or the "Unofficial" ones, i.e. less maintained ones) at least
    provides the name of the language, possibly in English, ideally
    self-localized in its own language.
    
    Unfortunately Kabyle didn't have any language file so we were using the
    Default one, which ended up showing the lang as a duplicate (and very
    wrong) "English".
    
    With this commit, I add code to provide our own very basic base language
    file, which would at least contain the language name. There is also a
    concept of language ID to be verified in Windows-provided list.
    Unfortunately it doesn't have any (actually it was id-ed 0x1000 like
    many other languages, which looked therefore to be the code for an
    unsupported lang). InnoSetup docs tells us to leave 0 then. We can add
    the ability to set a specific code later in the template if we add other
    un-provided languages and if they have their own lang id.
    
    With this base infrastructure, we should be able to better support more
    languages.

 build/windows/installer/gimp3264.iss        |  2 +-
 build/windows/installer/lang/meson.build    | 17 ++++++++++++++++-
 build/windows/installer/lang/newlang.isl.in | 15 +++++++++++++++
 3 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/build/windows/installer/gimp3264.iss b/build/windows/installer/gimp3264.iss
index 7b90639c3d..40b82c7982 100755
--- a/build/windows/installer/gimp3264.iss
+++ b/build/windows/installer/gimp3264.iss
@@ -207,7 +207,7 @@ Name: "is"; MessagesFile: "compiler:Languages\Icelandic.isl,lang\is.setup.isl"
 Name: "it"; MessagesFile: "compiler:Languages\Italian.isl,lang\it.setup.isl"
 Name: "ja"; MessagesFile: "compiler:Languages\Japanese.isl,lang\ja.setup.isl"
 Name: "ka"; MessagesFile: "compiler:Languages\Unofficial\Georgian.isl,lang\ka.setup.isl"
-Name: "kab"; MessagesFile: "compiler:Default.isl,lang\kab.setup.isl"
+Name: "kab"; MessagesFile: "compiler:Default.isl,lang\kab.isl,lang\kab.setup.isl"
 Name: "ko"; MessagesFile: "compiler:Languages\Unofficial\Korean.isl,lang\ko.setup.isl"
 Name: "lt"; MessagesFile: "compiler:Languages\Unofficial\Lithuanian.isl,lang\lt.setup.isl"
 Name: "lv"; MessagesFile: "compiler:Languages\Unofficial\Latvian.isl,lang\lv.setup.isl"
diff --git a/build/windows/installer/lang/meson.build b/build/windows/installer/lang/meson.build
index c2ab94b53b..f7d5f13ec0 100644
--- a/build/windows/installer/lang/meson.build
+++ b/build/windows/installer/lang/meson.build
@@ -28,7 +28,7 @@ languages = [
   { 'code': 'it',    },
   { 'code': 'ja',    },
   { 'code': 'ka',    },
-  { 'code': 'kab',   },
+  { 'code': 'kab',   'langname': 'Taqbaylit' },
   { 'code': 'ko',    },
   { 'code': 'lt',    },
   { 'code': 'lv',    },
@@ -105,6 +105,21 @@ foreach language : languages
     ],
     build_by_default: true,
   )
+
+  if 'langname' in language
+    # Some languages may have no default language file provided by
+    # InnoSetup. When this happens, we must at least complete a very
+    # basic file showing the language name, otherwise it shows as
+    # "English".
+    newlang_isl = '@0@.isl'.format(language.get('code'))
+    newlang_conf = configuration_data()
+    newlang_conf.set('LANGNAME', language.get('langname'))
+    configure_file(
+      input : 'newlang.isl.in',
+      output : newlang_isl,
+      configuration : newlang_conf
+    )
+  endif
 endforeach
 
 test('windows-installer-langs',
diff --git a/build/windows/installer/lang/newlang.isl.in b/build/windows/installer/lang/newlang.isl.in
new file mode 100644
index 0000000000..a6a97aa96d
--- /dev/null
+++ b/build/windows/installer/lang/newlang.isl.in
@@ -0,0 +1,15 @@
+; A template to create the basic lang file for languages which are not
+; made available by InnoSetup, not even in the Unofficial/ folder.
+; See full list of languages:
+; https://github.com/jrsoftware/issrc/tree/main/Files/Languages
+;
+; Without this, they show as English in the
+; start list so we must add a language name (localized preferably) at
+; the very least.
+; See also the docs for the meanings of different fields:
+; https://jrsoftware.org/ishelp/index.php?topic=langoptionssection
+
+[LangOptions]
+LanguageName=@LANGNAME@
+LanguageID=$0
+LanguageCodePage=0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]