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

i18n Milestone 3: Wrap all public-facing strings #16628

Closed
daniellockyer opened this issue Apr 13, 2023 · 7 comments · Fixed by #16930
Closed

i18n Milestone 3: Wrap all public-facing strings #16628

daniellockyer opened this issue Apr 13, 2023 · 7 comments · Fixed by #16930
Labels
affects:i18n help wanted [triage] Ideal issues for contributors to help with pinned [triage] Ignored by stalebot

Comments

@daniellockyer
Copy link
Member

daniellockyer commented Apr 13, 2023

This issue is part of our community i18n project. The full project is documented on the Ghost forum.


✨ We have now started shipping our i18n beta in Ghost, and we're merging community pull requests to add & update languages.

However, not all public-facing strings in Portal and our member emails are currently interpolated for translations. In order to have a full set of translations, we need to ensure all strings are wrapped with the t(..) helper.

How to work on this issue

Setting up

  1. Clone the Ghost repository and set up your local environment for development
  2. Run yarn dev --portal to get things running at http://localhost:2368/
  3. Toggle Enable Portal translations (beta) from http://localhost:2368/ghost/#/settings/labs
  4. (optional) Change the Publication Language to make it easier to find uninterpolated strings: http://localhost:2368/ghost/#/settings/general

Wrapping strings

Once you've found a public-facing string from code review or by using Portal/Ghost signup emails, you can easily wrap it so it will be picked up for translation.

  1. Add t('..') around the string
    a. You may need to import the t function from the AppContext in Portal
  2. Run yarn translate within ghost/i18n to ensure the locale JSON files include the new strings

You can see plenty of examples of how this is currently done using this search query: https://github.com/search?q=repo%3ATryGhost%2FGhost+path%3Aghost%2Fportal+%7Bt%28%27&type=code

Please take extra care to ensure you pass any variables into the t function, and make sure HTML escaping does not cause problems with the output.

Contributing

Commit the changes and submit a PR for us to review and merge 🙂

Be sure to read the contributing guide and reference this issue on the 3rd line of the commit: https://github.com/TryGhost/Ghost/blob/main/.github/CONTRIBUTING.md


Thank you to all contributors on the i18n beta so far 🙏🏻

If you speak a language that is not included in our current set of supported languages, please consider submitting it 🌐

@daniellockyer daniellockyer added help wanted [triage] Ideal issues for contributors to help with affects:i18n pinned [triage] Ignored by stalebot labels Apr 13, 2023
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I made only these changes as I want to quickly see if my local environment was correctly set up. Only French texts have been translated in this commit.
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I wanted to try to translate a more complex case, but I think I might need a little help to finish.
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I made only these changes as I want to quickly see if my local environment was correctly set up. Only French texts have been translated in this commit.
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I wanted to try to translate a more complex case, but I think I might need a little help to finish.
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I made only these changes as I want to quickly see if my local environment was correctly set up. Only French texts have been translated in this commit.
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I wanted to try to translate a more complex case, but I think I might need a little help to finish.
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I made only these changes as I want to quickly see if my local environment was correctly set up. Only French texts have been translated in this commit.
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I wanted to try to translate a more complex case, but I think I might need a little help to finish.
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I made only these changes as I want to quickly see if my local environment was correctly set up. Only French texts have been translated in this commit.
benjaminrancourt added a commit to Merisia/Ghost that referenced this issue Apr 13, 2023
refs TryGhost#16628

I wanted to try to translate a more complex case, but I think I might need a little help to finish.
SimonBackx added a commit that referenced this issue May 2, 2023
@eugene0928
Copy link
Contributor

new language is added

eugene0928 added a commit to eugene0928/Ghost that referenced this issue May 17, 2023
sam-lord added a commit that referenced this issue May 24, 2023
refs: #16628

Added wrapping for as many easy / simple i18n strings as possible.
sam-lord added a commit that referenced this issue May 24, 2023
refs: #16628

Separate commit for these, this change was a little more complex since the string "Complimentary" was repeated several times, with different additional context.

I decided to keep "Complimentary" by itself as a translatable string, and concatenated a second string for the expiry.

If this would be better as 3 strings, then we could switch to having these:
- "Complimentary"
- "Complimentary ({{label}})"
- "Complimentary - Expires {{expiry date}}"

^ Makes sense only if the use of parentheses & hyphens would be changed in other locales
sam-lord added a commit that referenced this issue May 24, 2023
refs: #16628

This adds a library for interpolating strings with React components, which allows us to pass HTML elements / React components into our i18n templates. We can further templatize those components to have fully translated, nested components.
sam-lord added a commit that referenced this issue May 24, 2023
daniellockyer added a commit that referenced this issue May 25, 2023
refs #16628

- this wraps nearly all of the public strings in member signup/signin
  emails, so they are ready for translating
sam-lord added a commit that referenced this issue May 25, 2023
refs: #16628

Added wrapping for as many easy / simple i18n strings as possible.
sam-lord added a commit that referenced this issue May 25, 2023
refs: #16628

Separate commit for these, this change was a little more complex since the string "Complimentary" was repeated several times, with different additional context.

I decided to keep "Complimentary" by itself as a translatable string, and concatenated a second string for the expiry.

If this would be better as 3 strings, then we could switch to having these:
- "Complimentary"
- "Complimentary ({{label}})"
- "Complimentary - Expires {{expiry date}}"

^ Makes sense only if the use of parentheses & hyphens would be changed in other locales
sam-lord added a commit that referenced this issue May 25, 2023
refs: #16628

This adds a library for interpolating strings with React components, which allows us to pass HTML elements / React components into our i18n templates. We can further templatize those components to have fully translated, nested components.
sam-lord added a commit that referenced this issue May 25, 2023
sam-lord added a commit that referenced this issue May 25, 2023
sam-lord added a commit that referenced this issue May 25, 2023
refs: #16628

Added wrapping for as many easy / simple i18n strings as possible.
sam-lord added a commit that referenced this issue May 25, 2023
refs: #16628

Separate commit for these, this change was a little more complex since the string "Complimentary" was repeated several times, with different additional context.

I decided to keep "Complimentary" by itself as a translatable string, and concatenated a second string for the expiry.

If this would be better as 3 strings, then we could switch to having these:
- "Complimentary"
- "Complimentary ({{label}})"
- "Complimentary - Expires {{expiry date}}"

^ Makes sense only if the use of parentheses & hyphens would be changed in other locales
sam-lord added a commit that referenced this issue May 25, 2023
refs: #16628

This adds a library for interpolating strings with React components, which allows us to pass HTML elements / React components into our i18n templates. We can further templatize those components to have fully translated, nested components.
sam-lord added a commit that referenced this issue May 25, 2023
sam-lord added a commit that referenced this issue May 25, 2023
sam-lord added a commit that referenced this issue May 30, 2023
refs: #16628

Modified a couple of translation strings to reduce complexity and remove duplication
KMSand added a commit to KMSand/Ghost that referenced this issue Jun 2, 2023
🎨Translated to Spanish 

fixes TryGhost#16628 TryGhost#16628
The text was updated to Spanish so that the publicly visible strings that have been translated can be seen in Spanish.
KMSand added a commit to KMSand/Ghost that referenced this issue Jun 2, 2023
🎨Translated to Spanish 

fixes TryGhost#16628 TryGhost#16628 The text was updated to Spanish so that the publicly visible strings that have been translated can be seen in Spanish.
KMSand added a commit to KMSand/Ghost that referenced this issue Jun 2, 2023
🎨Translated to Spanish 

fixes TryGhost#16628 TryGhost#16628 The text was updated to Spanish so that the publicly visible strings that have been translated can be seen in Spanish.
@daniellockyer
Copy link
Member Author

^^ This was inadvertantly closed by the PR but we're basically done here anyway 🙂

@daordonez11
Copy link
Contributor

daordonez11 commented Mar 12, 2024

Hey @daniellockyer quick question could you apply the t(..) helper on email services? Today I found that email template paywall does not support translations and it is a public-facing string.

<p style="margin: 0 auto 1.5em auto; line-height: 1.6em; max-width: 440px;">Become a paid member of {{site.title}} to get access to all
<span style="white-space: nowrap;">subscriber-only content.</span></p>

Is there a way to include translation into this component? I can help with solving that issue. I'm currently trying to work with Ghost(Pro) to build a Spanish newsletter.

@daordonez11
Copy link
Contributor

daordonez11 commented Mar 20, 2024

Hello, @daniellockyer were you able to give this ^ comment a look? I'm not sure if I should create a request in the forum or how to raise this issue.

royalfig added a commit that referenced this issue Apr 3, 2024
Got some code for us? Awesome 🎊!

Please include a description of your change & check your PR against this
list, thanks!

- [x] There's a clear use-case for this code change, explained below
- [x] Commit message has a short title & references relevant issues
- [x] The build will pass (run `yarn test:all` and `yarn lint`)

We appreciate your contribution!

Explanation: There are some missing accents in:


https://github.com/TryGhost/Ghost/blob/4c598a1e6d382191ac0d5ba769a25ea847f9ac53/ghost/i18n/locales/es/comments.json#L18-L19

And


https://github.com/TryGhost/Ghost/blob/4c598a1e6d382191ac0d5ba769a25ea847f9ac53/ghost/i18n/locales/es/comments.json#L37

Specifically in: Conviertete, Se. So instead of including accents I just
used simpler words so it sounds as a more natural translation, I have
already translated my whole newsletter https://crecimientoconsciente.co/
to Spanish I'm just finishing some wording details.

Also if you could please give a check to this
[comment](#16628 (comment))
in milestone 3 of translations for official support in email paywall
cta.

Co-authored-by: Ryan Feigenbaum <48868107+royalfig@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:i18n help wanted [triage] Ideal issues for contributors to help with pinned [triage] Ignored by stalebot
Projects
None yet
5 participants