refs https://ghost.slack.com/archives/C02G9E68C/p1692784819620269
refs https://github.com/TryGhost/Product/issues/3504
- Somehow, when using i18n in TypeScript, the require will put some of the keys into 'default' and not into the root. Mainly all keys that have a space in them. Couldn't find any documentation about this
- The solution is to also add 'default' to the keys that are being used in the code
This change also fixes the translate script (wasn't updated for updated paths), includes the missing translations, and already adds comments to lookup translation strings
refs: https://github.com/TryGhost/Toolbox/issues/595
We're rolling out new rules around the node assert library, the first of which is enforcing the use of assert/strict. This means we don't need to use the strict version of methods, as the standard version will work that way by default.
This caught some gotchas in our existing usage of assert where the lack of strict mode had unexpected results:
- Url matching needs to be done on `url.href` see aa58b354a4
- Null and undefined are not the same thing, there were a few cases of this being confused
- Particularly questionable changes in [PostExporter tests](c1a468744b) tracked [here](https://github.com/TryGhost/Team/issues/3505).
- A typo see eaac9c293a
Moving forward, using assert strict should help us to catch unexpected behaviour, particularly around nulls and undefineds during implementation.
closes https://github.com/TryGhost/Team/issues/3307
This commit includes several important updates to add internationalisation (i18n) support within the signup form package:
- Modified the translate script in `package.json` to include translations for the signup form.
- Added a new test for the signup form resources in `i18n.test.js`.
- Updated `tsconfig.json` to allow synthetic default imports.
- Made updates to `package.json`, including adding a prebuild command for `@tryghost/i18n` to ensure typescript declaration files get built.
- added `vite-plugin-commonjs` so we can bundle commonjs packages to be useable by the browser.
- In `App.tsx`, imported the `i18n` library and created an `i18n` instance for the `signup-form` namespace. This `i18n` instance's `t` function was added to the application context.
- Updated the `AppContextType` in `AppContext.ts` to include the `t` function from i18n
Co-authored-by: Daniel Lockyer <hi@daniellockyer.com>
refs https://github.com/TryGhost/Ghost/issues/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 :)