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 2: Framework and build tools #15502

Closed
10 tasks done
ErisDS opened this issue Sep 29, 2022 · 2 comments
Closed
10 tasks done

i18n Milestone 2: Framework and build tools #15502

ErisDS opened this issue Sep 29, 2022 · 2 comments
Assignees
Labels
feature [triage] New features we're planning or working on Hacktoberfest Issues suitable for hacktoberfest participants help wanted [triage] Ideal issues for contributors to help with

Comments

@ErisDS
Copy link
Member

ErisDS commented Sep 29, 2022

This issue represents a single milestone within our i18n project. The full project is documented on the Ghost forum.


Expected structure

  • A new ghost/locales folder in the monorepo contains namespaced JSON files e.g. locales/es/common.json, /ocales/es/portal.json, locales/es/email.json
  • For Node.js/email-templates we do one of:
    • (Preferred) The correct path is loaded from config based on environment
    • ghost/locales gets copied into ghost/core somehow
  • Then for react:
    • Use code-splitting to generate individual versions of portal for each supported locale.

Goals:

  • Get the basic pieces of i18next in place & configured according to the tech spec
  • Implement the expected structure (see above)
  • Figure out if we need to switch to vitejs in Portal to achieve the desired build (may need help from Ghost team)
  • Have 1 interpolated string in each of email and Portal
  • Tooling for extracting strings & generating files

Tasks:

  • Move Portal into the monorepo (Ghost team to complete soon)
  • Demo/spike of the build tool for Portal - I think this is the hardest part so we should do it first
  • Demo/spike of how locale files get pulled into Node.js for email templates
  • Demo/spike of i18next wiring so that there's one interpolated string in Portal and one in an email template
  • Demo/spike of a tooling that can grab the 2 interpolated strings e.g. yarn translate es would create /locales/es/portal.js and /locales/es/email.js each containing one string.

I'm hoping to find people interested in the different parts to do initial spike implementations - then we can figure out the tasks more clearly.


Notes on participating & Hacktoberfest:

We aren't going to merge half-baked spikes or wiring that doesn't match the spec yet - so if you're just trying to get through Hacktoberfest as fast as possible, this is not the issue for you! (There are plenty of small bugs though!)

However, if you're using Hacktoberfest as a vehicle to find a cool & meaningful project to work on, this should be well up your street :)

We'll do our best to ensure that those who actively contribute value to this project get something merged and appropriately labelled by the end of Hacktoberfest 🎃

👉 If you're interested, drop a note to say Hi and which part you're interested in before getting stuck in, just in case we end up with multiple people trying to get the same things merged.

@ErisDS ErisDS added help wanted [triage] Ideal issues for contributors to help with feature [triage] New features we're planning or working on Hacktoberfest Issues suitable for hacktoberfest participants labels Sep 29, 2022
@ErisDS
Copy link
Member Author

ErisDS commented Oct 7, 2022

Portal is now officially part of the monorepo and the dev workflow is working really well.

By default yarn dev will pull the latest release of portal from jsDelivr. If you're actively working on Portal, you can run yarn dev --portal and you'll get your live local version of portal as well as Ghost & Ghost Admin 🙌

Would love to get some volunteers to start wiring up i18next.

@daniellockyer daniellockyer self-assigned this Jan 16, 2023
daniellockyer added a commit that referenced this issue Jan 18, 2023
refs #15502

- this is an early implementation of an i18n provider by
  exporting an instance of `i18next`
- there's a lot more to be done here but baby steps :)
daniellockyer added a commit that referenced this issue Jan 18, 2023
refs #15502

- this is an early implementation of an i18n provider by
  exporting an instance of `i18next`
- there's a lot more to be done here but baby steps :)
daniellockyer added a commit that referenced this issue Jan 18, 2023
refs #15502

- plain JSON files are cleaner and less overwhelming than boilerplate JS
  files, and given they're going to be automatically generated, we
  probably won't be able to support comments anyway
daniellockyer added a commit that referenced this issue Jan 18, 2023
refs #15502

- the amazing `i18next-parser` dependency will extract our translated
  strings from Portal and dump them into locale files, so we never have
  to add them manually
daniellockyer added a commit that referenced this issue Jan 18, 2023
refs #15502

- prevent it from creating `_old` files
- set JSON indentation to 4 spaces
daniellockyer added a commit that referenced this issue Jan 19, 2023
refs #15502

- this will test if we have strings that aren't present in the JSON
  files in CI, so we don't miss out on translations
daniellockyer added a commit that referenced this issue Feb 20, 2023
refs #15502

- needed to add the `i18n` tests so we don't lose the "Hello" test I
  wrote, and keeping everything under one command is easier
daniellockyer added a commit that referenced this issue Feb 27, 2023
refs #15502

- this adds the package to Portal and integrates it into the state we
  pass around
- note: I've currently left the detection of the language
  (`site.locale`) commented for now until we flesh more of the
  implementation out
daniellockyer added a commit that referenced this issue Feb 27, 2023
refs #15502

- in the event the value is an empty string, we want to return the key
- this config option enables that
daniellockyer added a commit that referenced this issue Feb 27, 2023
refs #15502

- this allows use of the `t` function whilst running tests
daniellockyer added a commit that referenced this issue Feb 27, 2023
refs #15502

- in order to use the translations, strings must be wrapped in the `t`
  function, which is passed through AppContext
- whilst I haven't instrumented all public strings, the vast majority
  are done here and the strings have been brought into the JSON locale files using `yarn translate:generate`
daniellockyer added a commit that referenced this issue Feb 28, 2023
refs #15502

- in order to use the translations, strings must be wrapped in the `t`
  function, which is passed through AppContext
- whilst I haven't instrumented all public strings, the vast majority
  are done here and the strings have been brought into the JSON locale files using `yarn translate:generate`
daniellockyer added a commit that referenced this issue Mar 1, 2023
refs #15502

- this adds support for namespaces to the i18n package so we can
  separate translations for different packages
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- this adds the scaffolding for enabling i18n translations within Ghost
  core
- also adds `yarn translate:ghost` as an option to the `i18n` package
- the locale is currently hardcoded to `en` so we don't utilize the
  translations until we're ready
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- this adds the scaffolding for enabling i18n translations within Ghost
  core
- also adds `yarn translate:ghost` as an option to the `i18n` package
- the locale is currently hardcoded to `en` so we don't utilize the
  translations until we're ready
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- this adds the i18n translation wrapper to the titles, plaintext
  versions and one HTML version of the member emails
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- this commit migrates Portal from CRA to Vite, as it brings the
  package more inline with the direction we're going in terms of tooling
  for builds
- the bulk of the changes here are just config related to get things
  working with Vite, and then cleaning up all the CRA boilerplate
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- this adds the i18n translation wrapper to the titles, plaintext
  versions and one HTML version of the member emails
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- this commit migrates Portal from CRA to Vite, as it brings the
  package more inline with the direction we're going in terms of tooling
  for builds
- the bulk of the changes here are just config related to get things
  working with Vite, and then cleaning up all the CRA boilerplate
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- this makes the translations files a lot nicer because they only
  contain one line per key
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- this makes the translations files a lot nicer because they only
  contain one line per key
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- these aren't going to change across languages so we can exclude them
  from the strings to simplify things
daniellockyer added a commit that referenced this issue Mar 16, 2023
refs #15502

- these aren't going to change across languages so we can exclude them
  from the strings to simplify things
@daniellockyer
Copy link
Member

Hi all! 👋🏻 The tasks above has been completed and milestone 2 is complete 🙂 We're doing some testing internally and then we'll look at opening it up to translations 🕺🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature [triage] New features we're planning or working on Hacktoberfest Issues suitable for hacktoberfest participants help wanted [triage] Ideal issues for contributors to help with
Projects
None yet
Development

No branches or pull requests

2 participants