-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix multiline export #82
Merged
leonelquinteros
merged 4 commits into
leonelquinteros:master
from
didrocks:fix-multiline-export
Aug 29, 2023
Merged
Fix multiline export #82
leonelquinteros
merged 4 commits into
leonelquinteros:master
from
didrocks:fix-multiline-export
Aug 29, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The extraction of gettext entry does not translate properly multiline nor backquotes: * Multilines are printed as is, instead of follow the gettext spec: https://www.gnu.org/software/gettext/manual/html_node/Normalizing.html * Strings with backquotes as printed as “msgid `this is my string`”, * Multilines strings with backquotes are formatted as multi-lines to, without closing quotes on each lines. The loading is correct though, this only impact the generation file. Those generated files are thus then invalid and can’t be compile to mo file.
Ensure that the .po reflects latest translations (some were missing) Add more translations to reflect the new fixed use cases.
Ensure we follow the same rule when exporting to text format. This allows multi-line exports following the convention of single line, EOL at the end of the string and more.
This is the use case the more demanding: multi-line not finishing by EOL. Adapt the expect case for it.
didrocks
added a commit
to ubuntu/go-i18n
that referenced
this pull request
Jul 26, 2023
Hey @didrocks , thanks for the contribution! |
you’re really welcome @leonelquinteros |
nono
referenced
this pull request
in cozy/cozy-stack
Apr 15, 2024
…4376) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/leonelquinteros/gotext](https://togithub.com/leonelquinteros/gotext) | `v1.5.2` -> `v1.6.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fleonelquinteros%2fgotext/v1.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fleonelquinteros%2fgotext/v1.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fleonelquinteros%2fgotext/v1.5.2/v1.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fleonelquinteros%2fgotext/v1.5.2/v1.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>leonelquinteros/gotext (github.com/leonelquinteros/gotext)</summary> ### [`v1.6.0`](https://togithub.com/leonelquinteros/gotext/releases/tag/v1.6.0) [Compare Source](https://togithub.com/leonelquinteros/gotext/compare/v1.5.2...v1.6.0) #### What's Changed - Allow locale to use a `fs.FS` by [@​kobergj](https://togithub.com/kobergj) in [https://github.com/leonelquinteros/gotext/pull/68](https://togithub.com/leonelquinteros/gotext/pull/68) - Runtime translation detection by [@​m-horky](https://togithub.com/m-horky) in [https://github.com/leonelquinteros/gotext/pull/69](https://togithub.com/leonelquinteros/gotext/pull/69) - feat: Add language getter for Locale by [@​taozhou-glean](https://togithub.com/taozhou-glean) in [https://github.com/leonelquinteros/gotext/pull/77](https://togithub.com/leonelquinteros/gotext/pull/77) - Allow setting global storage by [@​didrocks](https://togithub.com/didrocks) in [https://github.com/leonelquinteros/gotext/pull/80](https://togithub.com/leonelquinteros/gotext/pull/80) - Fix multiline export by [@​didrocks](https://togithub.com/didrocks) in [https://github.com/leonelquinteros/gotext/pull/82](https://togithub.com/leonelquinteros/gotext/pull/82) - Order locations in ascii order by [@​didrocks](https://togithub.com/didrocks) in [https://github.com/leonelquinteros/gotext/pull/83](https://togithub.com/leonelquinteros/gotext/pull/83) - Fix io/fs File leak by [@​diamondburned](https://togithub.com/diamondburned) in [https://github.com/leonelquinteros/gotext/pull/79](https://togithub.com/leonelquinteros/gotext/pull/79) - Add support for multiple languages by [@​m-horky](https://togithub.com/m-horky) in [https://github.com/leonelquinteros/gotext/pull/73](https://togithub.com/leonelquinteros/gotext/pull/73) - Revert "Add support for multiple languages" by [@​leonelquinteros](https://togithub.com/leonelquinteros) in [https://github.com/leonelquinteros/gotext/pull/84](https://togithub.com/leonelquinteros/gotext/pull/84) - Remove unused dependency by [@​der-lyse](https://togithub.com/der-lyse) in [https://github.com/leonelquinteros/gotext/pull/86](https://togithub.com/leonelquinteros/gotext/pull/86) - Fix typo in documentation by [@​der-lyse](https://togithub.com/der-lyse) in [https://github.com/leonelquinteros/gotext/pull/87](https://togithub.com/leonelquinteros/gotext/pull/87) - Add support for multiple languages by [@​m-horky](https://togithub.com/m-horky) in [https://github.com/leonelquinteros/gotext/pull/85](https://togithub.com/leonelquinteros/gotext/pull/85) #### New Contributors - [@​kobergj](https://togithub.com/kobergj) made their first contribution in [https://github.com/leonelquinteros/gotext/pull/68](https://togithub.com/leonelquinteros/gotext/pull/68) - [@​m-horky](https://togithub.com/m-horky) made their first contribution in [https://github.com/leonelquinteros/gotext/pull/69](https://togithub.com/leonelquinteros/gotext/pull/69) - [@​taozhou-glean](https://togithub.com/taozhou-glean) made their first contribution in [https://github.com/leonelquinteros/gotext/pull/77](https://togithub.com/leonelquinteros/gotext/pull/77) - [@​didrocks](https://togithub.com/didrocks) made their first contribution in [https://github.com/leonelquinteros/gotext/pull/80](https://togithub.com/leonelquinteros/gotext/pull/80) - [@​diamondburned](https://togithub.com/diamondburned) made their first contribution in [https://github.com/leonelquinteros/gotext/pull/79](https://togithub.com/leonelquinteros/gotext/pull/79) - [@​der-lyse](https://togithub.com/der-lyse) made their first contribution in [https://github.com/leonelquinteros/gotext/pull/86](https://togithub.com/leonelquinteros/gotext/pull/86) **Full Changelog**: leonelquinteros/gotext@v1.5.2...v1.6.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 6am on Monday" in timezone Europe/Paris, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/cozy/cozy-stack). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before creating your Pull Request...
Is this a fix, improvement or something else?
This is fix on multiline and backquote supports for i18n pot and po file export.
What does this change implement/fix?
This changes impacts both the xgettext tooling and po file marshalling to text to conform to gettext specification: https://www.gnu.org/software/gettext/manual/html_node/Normalizing.html
When exporting from a po and extracting text from files, there are multiple issues for multi-line and backquotes usage. This is fine until we use standard gettext tooling for compiling them to mo files.
multilines are printed as is, instead of follow the gettext spec ( )
strings with backquotes as printed as “msgid this is my string”, which then can’t be compiled to mo files.
multilines strings with backquotes are formatted as multi-lines to, without closing quotes on each lines.
The loading is correct though, this only impact the generation file. Those generated files are thus then invalid and can’t be compile to mo file.
Check #81 for the general use cases transformation of po files.
Tests have been updated and some added.
I have ...