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

Address invalid localization files #8081

Open
11 tasks
jonasraoni opened this issue Jul 6, 2022 · 7 comments
Open
11 tasks

Address invalid localization files #8081

jonasraoni opened this issue Jul 6, 2022 · 7 comments
Assignees
Labels
Enhancement:2:Moderate A new feature or improvement that can be implemented in less than 4 weeks.

Comments

@jonasraoni
Copy link
Contributor

jonasraoni commented Jul 6, 2022

Describe the bug
Some of our localization files might have an invalid syntax, they might work, due to lax parsers, but also cause unexpected issues with other softwares:

Besides that, as the localization is also maintained by non-technical people, it makes sense to ensure some things are not broken on the way.

Solution

  • Require the review of changes made to the default locale (e.g. user changed a translation and removed a variable) at Weblate (or review them carefully when integrating updates)
  • Write a validation tool
  • Integrate the tool into the GitHub Actions to validate the plugins/applications
  • Consider ideas from Tool to detect unused locale keys #7978
  • Consider ideas from pkp/ojs@baf1ce4
  • Validate syntax of .po files
  • Validate variables
    • Variables from the default locale should be present on the other locales
    • The variable name should be in camel case
    • Unexpected extra variables on the side locales can be flagged during build time
  • During build time, the Locale class might also flag variables which were passed to it, but not used/replaced (something might be missing)

The tool can be written for stable-3_3_0, as it's not a breaking change.

What application are you using?
OJS/main

@jonasraoni jonasraoni self-assigned this Jul 6, 2022
jonasraoni referenced this issue in pkp/ops Jul 6, 2022
Currently translated at 100.0% (92 of 92 strings)

Translation: Open Preprint Systems/locale
Translate-URL: http://translate.pkp.sfu.ca/projects/ops/locale/en_US/
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Jul 11, 2022
@jonasraoni
Copy link
Contributor Author

jonasraoni commented Jul 11, 2022

@asmecher I've created a PR for the pkp-lib/main here:

I've added a generic validator for the locale files, and most of the fixes are to satisfy the requirements and warnings of the msgfmt validator.

I've tried to isolate the commits, except the 4f379aa... There I used the gettext package to setup the plurals, and it also formatted and removed duplicated entries (inside the same file).

If everything sounds fine, I'll update the other branches.

p.s.: I'm able to reduce the line-break noise by doing a small change to the gettext package.

@jonasraoni
Copy link
Contributor Author

For the stable-3_3_0, I can pass my modified validator through the locale files, and fix the breaking issues.

I also think it's ok to add the validate-locale.sh in a non-breaking way (e.g. emit errors without failing the build)

@asmecher
Copy link
Member

Please hold off on this until we've reached a decision about translation workflows on this discussion: #8038

@jonasraoni
Copy link
Contributor Author

Ok! So I'll just commit fixes for the broken keys (e.g. missing quotes, bad escaping, ...).

@asmecher
Copy link
Member

Yes please -- I've recently merged translations from Weblate so now is a good time.

@jonasraoni
Copy link
Contributor Author

Just to confirm, I've updated the broken files.

@jonasraoni
Copy link
Contributor Author

jonasraoni commented Jul 28, 2022

@asmecher I've reviewed and moved the fixes related to duplicated keys here #8119

Also, I fixed the syntax errors on stable-3_3_0.

@jonasraoni jonasraoni added the Enhancement:2:Moderate A new feature or improvement that can be implemented in less than 4 weeks. label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement:2:Moderate A new feature or improvement that can be implemented in less than 4 weeks.
Projects
None yet
Development

No branches or pull requests

3 participants