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

Improve translation handling #701

Merged
merged 1 commit into from
Aug 11, 2023
Merged

Improve translation handling #701

merged 1 commit into from
Aug 11, 2023

Conversation

lslezak
Copy link
Contributor

@lslezak lslezak commented Aug 11, 2023

Improvements

  • Use the C language in the xgettext call (surprisingly handles JSX files better than the JavaScript language)
    • On the other hand the C language does not handle JS template string with backticks, that needs to be replaced
    • And multiline texts enabled in ESLint
  • Move the xgettext call to a separate script so it can be run locally for easier testing
  • Use C placeholder format (%s, %d) in the texts, that allows using the javascript-format attributes
    • That requires a trivial format-util library

This enables using the format attributes in the POT file:

#. TRANSLATORS: %s is replaced by a network connection name
#: src/components/network/ConnectionsTable.jsx:70
#, javascript-format
msgid "Edit connection %s"
msgstr ""

This should help with validating the translations.

- Use C placeholder format (%s, %d) in the texts
- Use the C language in xgettext (surprisingly handles JSX files better
  than the JavaScript language)
@lslezak lslezak merged commit fff5ddf into master Aug 11, 2023
10 checks passed
@lslezak lslezak deleted the web_translations branch August 11, 2023 13:50
@imobachgs imobachgs mentioned this pull request Sep 26, 2023
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.

2 participants