mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
Added locales/context.json
to help with translating
refs https://ghost.slack.com/archives/CFH10N79S/p1679491616052209?thread_ts=1679411948.063929&cid=CFH10N79S - this adds a small script to generate a `context.json` file, which contains all keys and allows people to provide context on the translation
This commit is contained in:
parent
ef353db39a
commit
3432857f9a
28
ghost/i18n/generate-context.js
Normal file
28
ghost/i18n/generate-context.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
const fs = require('fs').promises;
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const BASE_PATH = './locales/en';
|
||||||
|
const CONTEXT_FILE = './locales/context.json';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const context = require(CONTEXT_FILE);
|
||||||
|
const newContext = {};
|
||||||
|
|
||||||
|
const files = await fs.readdir(BASE_PATH);
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
const filePath = path.join(process.cwd(), BASE_PATH, file);
|
||||||
|
const data = require(filePath);
|
||||||
|
|
||||||
|
for (const key of Object.keys(data)) {
|
||||||
|
newContext[key] = context[key] || '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const orderedContext = Object.keys(newContext).sort().reduce((obj, key) => {
|
||||||
|
obj[key] = newContext[key];
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
await fs.writeFile(CONTEXT_FILE, JSON.stringify(orderedContext, null, 4));
|
||||||
|
})();
|
86
ghost/i18n/locales/context.json
Normal file
86
ghost/i18n/locales/context.json
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
"A login link has been sent to your inbox. If it doesn't arrive in 3 minutes, be sure to check your spam folder.": "",
|
||||||
|
"Account": "",
|
||||||
|
"Account settings": "",
|
||||||
|
"After a free trial ends, you will be charged the regular price for the tier you've chosen. You can always cancel before then.": "",
|
||||||
|
"All the best!": "",
|
||||||
|
"Already a member?": "",
|
||||||
|
"Back": "",
|
||||||
|
"Back to Log in": "",
|
||||||
|
"Cancel subscription": "",
|
||||||
|
"Cancellation reason": "",
|
||||||
|
"Choose a different plan": "",
|
||||||
|
"Choose your newsletters": "",
|
||||||
|
"Close": "",
|
||||||
|
"Comments": "",
|
||||||
|
"Complete your sign up to {{siteTitle}}!": "",
|
||||||
|
"Confirm": "",
|
||||||
|
"Confirm your email update for {{siteTitle}}!": "",
|
||||||
|
"Confirm your subscription to {{siteTitle}}": "",
|
||||||
|
"Continue": "",
|
||||||
|
"Delete account": "",
|
||||||
|
"Don't have an account?": "",
|
||||||
|
"Email": "",
|
||||||
|
"Email preference updated.": "",
|
||||||
|
"Email preferences": "",
|
||||||
|
"Emails": "",
|
||||||
|
"Emails disabled": "",
|
||||||
|
"For your security, the link will expire in 24 hours time.": "",
|
||||||
|
"Get help": "",
|
||||||
|
"Get notified when someone replies to your comment": "",
|
||||||
|
"Give feedback on this post": "",
|
||||||
|
"Hello": "",
|
||||||
|
"Hey there,": "",
|
||||||
|
"If you did not make this request, you can safely ignore this email.": "",
|
||||||
|
"If you did not make this request, you can simply delete this message.": "",
|
||||||
|
"Less like this": "",
|
||||||
|
"Manage": "",
|
||||||
|
"Monthly": "",
|
||||||
|
"More like this": "",
|
||||||
|
"Name": "",
|
||||||
|
"Not receiving emails?": "",
|
||||||
|
"Now check your email!": "",
|
||||||
|
"Please confirm your email address with this link:": "",
|
||||||
|
"Powered by Ghost": "",
|
||||||
|
"Price": "",
|
||||||
|
"Re-enable emails": "",
|
||||||
|
"Retry": "",
|
||||||
|
"Save": "",
|
||||||
|
"Secure sign in link for {{siteTitle}}": "",
|
||||||
|
"See you soon!": "",
|
||||||
|
"Sending login link...": "",
|
||||||
|
"Sending...": "",
|
||||||
|
"Sent to {{email}}": "",
|
||||||
|
"Sign in": "",
|
||||||
|
"Sign in to {{siteTitle}}": "",
|
||||||
|
"Sign up": "",
|
||||||
|
"Start {{amount}}-day free trial": "",
|
||||||
|
"Submit feedback": "",
|
||||||
|
"Successfully unsubscribed": "",
|
||||||
|
"Tap the link below to complete the signup process for {{siteTitle}}, and be automatically signed in:": "",
|
||||||
|
"Thank you for signing up to {{siteTitle}}!": "",
|
||||||
|
"Thank you for subscribing to {{siteTitle}}!": "",
|
||||||
|
"Thank you for subscribing to {{siteTitle}}. Tap the link below to be automatically signed in:": "",
|
||||||
|
"Thanks for the feedback!": "",
|
||||||
|
"That didn't go to plan": "",
|
||||||
|
"This email address will not be used.": "",
|
||||||
|
"This site is invite-only, contact the owner for access.": "",
|
||||||
|
"To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!": "",
|
||||||
|
"Unsubscribe from all emails": "",
|
||||||
|
"Unsubscribing from emails will not cancel your paid subscription to {{title}}": "",
|
||||||
|
"Update your preferences": "",
|
||||||
|
"We couldn't unsubscribe you as the email address was not found. Please contact the site owner.": "",
|
||||||
|
"Welcome back to {{siteTitle}}!": "",
|
||||||
|
"Welcome back! Use this link to securely sign in to your {{siteTitle}} account:": "",
|
||||||
|
"Yearly": "",
|
||||||
|
"You can also copy & paste this URL into your browser:": "",
|
||||||
|
"You have been successfully resubscribed": "",
|
||||||
|
"You will not be signed up, and no account will be created for you.": "",
|
||||||
|
"You will not be subscribed.": "",
|
||||||
|
"You're not receiving emails because you either marked a recent message as spam, or because messages could not be delivered to your provided email address.": "",
|
||||||
|
"You're one tap away from subscribing to {{siteTitle}} — please confirm your email address with this link:": "",
|
||||||
|
"Your account": "",
|
||||||
|
"Your input helps shape what gets published.": "",
|
||||||
|
"{{discount}}% discount": "",
|
||||||
|
"{{trialDays}} days free": ""
|
||||||
|
}
|
@ -12,7 +12,7 @@
|
|||||||
"lint:code": "eslint *.js lib/ --ext .js --cache",
|
"lint:code": "eslint *.js lib/ --ext .js --cache",
|
||||||
"lint": "yarn lint:code && yarn lint:test",
|
"lint": "yarn lint:code && yarn lint:test",
|
||||||
"lint:test": "eslint -c test/.eslintrc.js test/ --ext .js --cache",
|
"lint:test": "eslint -c test/.eslintrc.js test/ --ext .js --cache",
|
||||||
"translate": "yarn translate:ghost && yarn translate:portal && yarn translate:test",
|
"translate": "yarn translate:ghost && yarn translate:portal && yarn translate:test && node generate-context.js",
|
||||||
"translate:ghost": "NAMESPACE=ghost i18next '../core/core/{frontend,server,shared}/**/*.{js,jsx}'",
|
"translate:ghost": "NAMESPACE=ghost i18next '../core/core/{frontend,server,shared}/**/*.{js,jsx}'",
|
||||||
"translate:portal": "NAMESPACE=portal i18next '../portal/src/**/*.{js,jsx}'",
|
"translate:portal": "NAMESPACE=portal i18next '../portal/src/**/*.{js,jsx}'",
|
||||||
"translate:test": "NAMESPACE=test i18next './test/**/*.js'"
|
"translate:test": "NAMESPACE=test i18next './test/**/*.js'"
|
||||||
|
Loading…
Reference in New Issue
Block a user