Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge back the product translations #853

Merged
merged 1 commit into from
Nov 8, 2023
Merged

Merge back the product translations #853

merged 1 commit into from
Nov 8, 2023

Conversation

lslezak
Copy link
Contributor

@lslezak lslezak commented Nov 8, 2023

Problem

Solution

  • Read the translations from the PO files and and merge them back to the original YAML product files
  • Implement a GitHub Action which regularly opens a pull request with updated translations (similar to the current solution with the web frontend translations)

Notes

  • Originally I wanted to use keys like description-cs, description-de,... for the translations, but then the translations could be scattered over the whole file (the order is not guaranteed or forced)
  • So use a new translations key with a reference to the original key:
    description: "Original description ...."
    translations:
      description:
        cs: "Czech translation..."
        de: "German translation ..."
        es: "Spanish translation ..."
    This also allows translating some other keys if needed in the future.
  • When changing the original description the translations need to be manually deleted because they would not match the original text anymore. If we forget that the next run of this GitHub Action will remove them anyway (or update with the new translations if they are already available) . So accidental invalid translations should not stay here for too long.

Testing

@@ -51,7 +51,7 @@ class POFile {
*/
timestamp() {
const date = new Date();
return date.getUTCFullYear() + "-" + date.getUTCMonth() + "-" +
return date.getUTCFullYear() + "-" + (date.getUTCMonth() + 1) + "-" +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fix for the previous PR, it turned out that the month (and only the month!!) starts from zero.

description: 'SUSE ALP Dolomite is a minimum immutable OS core, focused on
security to provide the bare minimum to run workloads and services as
containers or virtual machines.'
translations:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly adding an empty translations key. Otherwise the script would add it at the end of the file and it is better to have the translations close to the original text.

@coveralls
Copy link

Coverage Status

coverage: 75.063%. remained the same
when pulling 08961a1 on lslezak:master
into 6ae6d69 on openSUSE:master.

@lslezak lslezak merged commit 2966fc8 into agama-project:master Nov 8, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants