Ghost/ghost/i18n
Cathy Sarisky 1d429b8b09
🌐Added i18n for newsletter strings (#21433)
no issue

This PR adds the ability to translate the strings that appear in the
newsletter as boilerplate text, using i18next.

Variables are in single mustaches ( `{date}` ) in the translation
strings (rather than `{{date}}`), because these strings occur both the
email template.hbs and also .js files. That necessitated a separate
namespace.

This PR also includes changes to the newsletter button ("more like
this", "less like this", "comment") that were previously delivered on
desktop as images that included the text. @sanne-san provided a rework
that removed text-as-image from the desktop buttons, and allows more
shared code between the two layouts, along with making the buttons
translatable.

Example usage - handlebars
```
<h3 class="latest-posts-header">{{t 'Keep reading'}}</h3>

{{{t 'By {authors}' authors=post.authors }}} 
```
(NOTE: triple { required because of possible & )

Example usage - javascript
```
                getValue: (member) => {
                    if (member.status === 'comped') {
                        return t('complimentary');
                    }
                    if (this.isMemberTrialing(member)) {
                        return t('trialing');
                    }
                    // other possible statuses: t('free'), t('paid') //
                    return t(member.status);
                }
```

---------

Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
Co-authored-by: Steve Larson <9larsons@gmail.com>
2024-10-31 08:41:39 -05:00
..
lib 🌐Added i18n for newsletter strings (#21433) 2024-10-31 08:41:39 -05:00
locales 🌐Added i18n for newsletter strings (#21433) 2024-10-31 08:41:39 -05:00
test 🌐Added i18n for newsletter strings (#21433) 2024-10-31 08:41:39 -05:00
.eslintrc.js Added i18n package 2023-01-18 13:54:14 +01:00
generate-context.js Added locales/context.json to help with translating 2023-03-23 16:29:59 +01:00
i18next-parser.config.js Added support for namespaces to i18n package 2023-03-01 10:24:08 +01:00
index.js Added i18n package 2023-01-18 13:54:14 +01:00
package.json 🌐Added i18n for newsletter strings (#21433) 2024-10-31 08:41:39 -05:00
README.md Added i18n package 2023-01-18 13:54:14 +01:00

i18n

i18n translations for Ghost

Develop

This is a monorepo package.

Follow the instructions for the top-level repo.

  1. git clone this repo & cd into it as usual
  2. Run yarn to install top-level dependencies.

Test

  • yarn lint run just eslint
  • yarn test run lint and tests