From 7e0afc641c520d85780074ec685fac1d9fc3e215 Mon Sep 17 00:00:00 2001 From: Kyle Kienapfel Date: Fri, 24 Jun 2022 21:16:34 -0700 Subject: Translate english plurals Turns out that for Qt to properly handle plurals in English a translation needs to be provided, otherwise the user is left with messages such as "Building: 2 shader(s)" Plurals for other all other languages are handled on transifex. I wrote the README.md to just refer to it as a translation collaboration site just in case we ever switch. These translations being out of date won't pose any technical problems so I believe it is fine to handle them manually on a "best effort" basis. The files are generated into the source directory so that the relative filenames are correct. The generated file is added to .gitignore --- dist/english_plurals/README.md | 19 ++++++++++++ dist/english_plurals/en.ts | 67 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 dist/english_plurals/README.md create mode 100644 dist/english_plurals/en.ts (limited to 'dist') diff --git a/dist/english_plurals/README.md b/dist/english_plurals/README.md new file mode 100644 index 000000000..a4954f6a6 --- /dev/null +++ b/dist/english_plurals/README.md @@ -0,0 +1,19 @@ +# English Plurals + +Qt has "Translation Rules for Plurals", small example + + // Take a source line like + tr("Building: %n shader(s)", "", i) + + // i = 1: + Building: 1 shader + // i = 2: + Building: 2 shaders + +For yuzu the source language used is English, for all other languages handling of plurals is handled by Qt and the translation collaboration site. Handling plurals in the source language (English) requires special consideration. + +With CMake flag GENERATE_QT_TRANSLATION a generated_en.ts file is created from the source. It ignored by git (`.gitignore` in the project root). It is placed in this directory so that the relative refrences with the source code is correct. + +Having the plurals look nice isn't critical, and automation to use translation collaboration sites may require specifing the project language as "Pirate English", so this has been done manually. + +The en.ts in this directory is taken from a build, edited in Qt Linguist and then committed. As the code is in XML, using the tool is not strictly required. diff --git a/dist/english_plurals/en.ts b/dist/english_plurals/en.ts new file mode 100644 index 000000000..172cd4bba --- /dev/null +++ b/dist/english_plurals/en.ts @@ -0,0 +1,67 @@ + + + + + GMainWindow + + + %n file(s) remaining + + %n file remaining + %n files remaining + + + + + %n file(s) were newly installed + + + %n file was newly installed + + %n files were newly installed + + + + + + %n file(s) were overwritten + + + %n file was overwritten + + %n were overwritten + + + + + + %n file(s) failed to install + + + %n file failed to install + + %n files failed to install + + + + + + Building: %n shader(s) + + Building: %n shader + Building: %n shaders + + + + + GameListSearchField + + + %1 of %n result(s) + + %1 of %n result + %1 of %n results + + + + -- cgit v1.2.3