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

translations MVP #2662

Merged
merged 14 commits into from
Jun 5, 2023
Merged

translations MVP #2662

merged 14 commits into from
Jun 5, 2023

Conversation

ogoffart
Copy link
Member

This allow to translate a Slint interface using a @tr(".....") expression

TODO

  • plurals in @tr()
  • context in @tr() to disambiguate
  • polish string extraction and tooling
  • Example with translations in rust code
  • Example with translations in C++ code

@ogoffart ogoffart marked this pull request as draft April 28, 2023 13:12
Copy link
Member

@tronical tronical left a comment

Choose a reason for hiding this comment

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

Wonderful start! A few brief comments. Let me know when you'd like get detailed reviews.

tools/compiler/main.rs Outdated Show resolved Hide resolved
api/rs/slint/private_unstable_api.rs Outdated Show resolved Hide resolved
api/rs/slint/Cargo.toml Show resolved Hide resolved
examples/gallery/CMakeLists.txt Show resolved Hide resolved
@ogoffart ogoffart force-pushed the olivier/wip/translations branch from 458ae64 to 77f16be Compare April 28, 2023 16:34
@medhefgo
Copy link
Contributor

Just pitching in here to mention that gettext should not be forced/the only option. Fluent is considered to be better in many aspects and should be supported too.

@ogoffart
Copy link
Member Author

@medhefgo totally, we don't want to force gettext.
That said, fluent is using messages IDs rather than the actual text as idea, which is incompatible with the vision we have.

@medhefgo
Copy link
Contributor

Well, you can use message IDs in gettext too...
The more interesting difference is that fluent does the argument formatting itself (and afaiks has no positional args) and that plurals are fetched from the same function as singular messages.

Considering that, I guess it would be better to expose fluent as a separate function/macro (flt or so). And maybe gettext should be exposed as an explicit function/macro instead of a generic one (gtxt maybe, if it really has to be short names?). QML can get away with tr because it's the NIH translation system from Qt if I remember correctly.

@ogoffart ogoffart force-pushed the olivier/wip/translations branch from 0267079 to 712ecb0 Compare June 2, 2023 13:52
@ogoffart ogoffart changed the title WIP: translations MVP translations MVP Jun 2, 2023
@ogoffart ogoffart marked this pull request as ready for review June 2, 2023 14:26
@ogoffart ogoffart force-pushed the olivier/wip/translations branch from 728ed10 to 41a7fa9 Compare June 2, 2023 14:59
@ogoffart ogoffart force-pushed the olivier/wip/translations branch from 41a7fa9 to 3af3b58 Compare June 2, 2023 15:06
@ogoffart ogoffart merged commit 7d69d9b into master Jun 5, 2023
@ogoffart
Copy link
Member Author

ogoffart commented Jun 5, 2023

Merging this right now even if it is not 100% complete yet since we can buid on top for before the next release.

( @medhefgo : more discussion about fluent in #33 if you're interested )

@ogoffart ogoffart deleted the olivier/wip/translations branch June 12, 2023 12:19
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