mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 17:00:55 +00:00
Translations files generator
This commit is contained in:
parent
6de2503b9c
commit
88c39ba2d0
@ -6,7 +6,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import appMessages from 'containers/App/messages';
|
||||
import appMessages from 'containers/App/messages.json';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
@ -5,7 +5,10 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import messages from './messages';
|
||||
|
||||
import messages from './messages.json';
|
||||
import { define } from '../../i18n';
|
||||
define(messages);
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* PluginHeaderActions Messages
|
||||
*
|
||||
* This contains all the text for the PluginHeaderActions component.
|
||||
*/
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
export default defineMessages({
|
||||
cancelLabel: {
|
||||
id: 'settings-manager.components.PluginHeaderActions.cancelLabel',
|
||||
defaultMessage: 'Cancel',
|
||||
},
|
||||
saveLabel: {
|
||||
id: 'settings-manager.components.PluginHeaderActions.saveLabel',
|
||||
defaultMessage: 'Save',
|
||||
},
|
||||
});
|
10
public/app/components/PluginHeaderActions/messages.json
Normal file
10
public/app/components/PluginHeaderActions/messages.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"cancelLabel": {
|
||||
"id": "settings-manager.components.PluginHeaderActions.cancelLabel",
|
||||
"defaultMessage": "Cancel"
|
||||
},
|
||||
"saveLabel": {
|
||||
"id": "settings-manager.components.PluginHeaderActions.saveLabel",
|
||||
"defaultMessage": "Save"
|
||||
}
|
||||
}
|
@ -6,8 +6,10 @@
|
||||
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import messages from './messages.json';
|
||||
import { define } from '../../i18n';
|
||||
define(messages);
|
||||
|
||||
import messages from './messages';
|
||||
import styles from './styles.scss';
|
||||
|
||||
class PluginHeaderTitle extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* PluginHeaderTitle Messages
|
||||
*
|
||||
* This contains all the text for the PluginHeaderTitle component.
|
||||
*/
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
export default defineMessages({
|
||||
title: {
|
||||
id: 'settings-manager.components.PluginHeaderTitle.title',
|
||||
defaultMessage: 'Settings Manager',
|
||||
},
|
||||
description: {
|
||||
id: 'settings-manager.components.PluginHeaderTitle.description',
|
||||
defaultMessage: 'Easily configure your settings',
|
||||
},
|
||||
});
|
10
public/app/components/PluginHeaderTitle/messages.json
Normal file
10
public/app/components/PluginHeaderTitle/messages.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"title": {
|
||||
"id": "settings-manager.components.PluginHeaderTitle.title",
|
||||
"defaultMessage": "Settings Manager"
|
||||
},
|
||||
"description": {
|
||||
"id": "settings-manager.components.PluginHeaderTitle.description",
|
||||
"defaultMessage": "Easily configure your settings"
|
||||
}
|
||||
}
|
@ -11,8 +11,10 @@ import Container from 'components/Container';
|
||||
import RightContentTitle from 'components/RightContentTitle';
|
||||
import RightContentSectionTitle from 'components/RightContentSectionTitle';
|
||||
import { injectIntl, intlShape } from 'react-intl';
|
||||
import appMessages from 'containers/App/messages';
|
||||
import messages from './messages';
|
||||
import appMessages from 'containers/App/messages.json';
|
||||
import messages from './messages.json';
|
||||
import { define } from '../../i18n';
|
||||
define(messages);
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* LanguagesPage Messages
|
||||
*
|
||||
* This contains all the text for the LanguagesPage component.
|
||||
*/
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
export default defineMessages({
|
||||
rightSectionDescription: {
|
||||
id: 'settings-manager.components.AdvancedPage.rightSectionDescription',
|
||||
defaultMessage: 'Configure your advanced settings',
|
||||
},
|
||||
});
|
6
public/app/containers/AdvancedPage/messages.json
Normal file
6
public/app/containers/AdvancedPage/messages.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"rightSectionDescription": {
|
||||
"id": "settings-manager.components.AdvancedPage.rightSectionDescription",
|
||||
"defaultMessage": "Configure your advanced settings"
|
||||
}
|
||||
}
|
@ -8,6 +8,9 @@
|
||||
import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { store } from '../../app';
|
||||
import appMessages from 'containers/App/messages.json';
|
||||
import { define } from '../../i18n';
|
||||
define(appMessages);
|
||||
|
||||
import '../../styles/main.scss';
|
||||
|
||||
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* App Messages
|
||||
*
|
||||
* This contains all the text use across the plugin.
|
||||
*/
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
export default defineMessages({
|
||||
generalSectionTitle: {
|
||||
id: 'settings-manager.components.App.generalSectionTitle',
|
||||
defaultMessage: 'General',
|
||||
},
|
||||
languagesSectionTitle: {
|
||||
id: 'settings-manager.components.App.languagesSectionTitle',
|
||||
defaultMessage: 'Languages',
|
||||
},
|
||||
databasesSectionTitle: {
|
||||
id: 'settings-manager.components.App.databasesSectionTitle',
|
||||
defaultMessage: 'Databases',
|
||||
},
|
||||
securitySectionTitle: {
|
||||
id: 'settings-manager.components.App.securitySectionTitle',
|
||||
defaultMessage: 'Security',
|
||||
},
|
||||
serverSectionTitle: {
|
||||
id: 'settings-manager.components.App.serverSectionTitle',
|
||||
defaultMessage: 'Server',
|
||||
},
|
||||
advancedSectionTitle: {
|
||||
id: 'settings-manager.components.App.advancedSectionTitle',
|
||||
defaultMessage: 'Advanced',
|
||||
},
|
||||
comingSoon: {
|
||||
id: 'settings-manager.components.App.comingSoon',
|
||||
defaultMessage: 'Coming soon',
|
||||
},
|
||||
});
|
30
public/app/containers/App/messages.json
Normal file
30
public/app/containers/App/messages.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"generalSectionTitle": {
|
||||
"id": "settings-manager.components.App.generalSectionTitle",
|
||||
"defaultMessage": "General"
|
||||
},
|
||||
"languagesSectionTitle": {
|
||||
"id": "settings-manager.components.App.languagesSectionTitle",
|
||||
"defaultMessage": "Languages"
|
||||
},
|
||||
"databasesSectionTitle": {
|
||||
"id": "settings-manager.components.App.databasesSectionTitle",
|
||||
"defaultMessage": "Databases"
|
||||
},
|
||||
"securitySectionTitle": {
|
||||
"id": "settings-manager.components.App.securitySectionTitle",
|
||||
"defaultMessage": "Security"
|
||||
},
|
||||
"serverSectionTitle": {
|
||||
"id": "settings-manager.components.App.serverSectionTitle",
|
||||
"defaultMessage": "Server"
|
||||
},
|
||||
"advancedSectionTitle": {
|
||||
"id": "settings-manager.components.App.advancedSectionTitle",
|
||||
"defaultMessage": "Advanced"
|
||||
},
|
||||
"comingSoon": {
|
||||
"id": "settings-manager.components.App.comingSoon",
|
||||
"defaultMessage": "Coming soon"
|
||||
}
|
||||
}
|
@ -9,8 +9,10 @@ import Container from 'components/Container';
|
||||
import RightContentTitle from 'components/RightContentTitle';
|
||||
import RightContentSectionTitle from 'components/RightContentSectionTitle';
|
||||
import { injectIntl, intlShape } from 'react-intl';
|
||||
import appMessages from 'containers/App/messages';
|
||||
import messages from './messages';
|
||||
import appMessages from 'containers/App/messages.json';
|
||||
import messages from './messages.json';
|
||||
import { define } from '../../i18n';
|
||||
define(messages);
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* LanguagesPage Messages
|
||||
*
|
||||
* This contains all the text for the LanguagesPage component.
|
||||
*/
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
export default defineMessages({
|
||||
rightSectionDescription: {
|
||||
id: 'settings-manager.components.DatabasesPage.rightSectionDescription',
|
||||
defaultMessage: 'Configure your databases settings',
|
||||
},
|
||||
});
|
6
public/app/containers/DatabasesPage/messages.json
Normal file
6
public/app/containers/DatabasesPage/messages.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"rightSectionDescription": {
|
||||
"id": "settings-manager.components.DatabasesPage.rightSectionDescription",
|
||||
"defaultMessage": "Configure your databases settings"
|
||||
}
|
||||
}
|
@ -32,8 +32,10 @@ import {
|
||||
cancelGeneralSettings,
|
||||
} from 'containers/HomePage/actions';
|
||||
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
||||
import appMessages from 'containers/App/messages';
|
||||
import messages from './messages';
|
||||
import appMessages from 'containers/App/messages.json';
|
||||
import messages from './messages.json';
|
||||
import { define } from '../../i18n';
|
||||
define(messages);
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* HomePage Messages
|
||||
*
|
||||
* This contains all the text for the HomePage component.
|
||||
*/
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
export default defineMessages({
|
||||
rightSectionDescription: {
|
||||
id: 'settings-manager.components.HomePage.rightSectionDescription',
|
||||
defaultMessage: 'Configure your general settings',
|
||||
},
|
||||
rightContentSectionTitle: {
|
||||
id: 'settings-manager.components.HomePage.rightContentSectionTitle',
|
||||
defaultMessage: 'Application',
|
||||
},
|
||||
rightContentSectionDescription: {
|
||||
id: 'settings-manager.components.HomePage.rightContentSectionDescription',
|
||||
defaultMessage: 'The general settings of your Strapi application.',
|
||||
},
|
||||
nameLabel: {
|
||||
id: 'settings-manager.components.HomePage.nameLabel',
|
||||
defaultMessage: 'Name',
|
||||
},
|
||||
namePlaceholder: {
|
||||
id: 'settings-manager.components.HomePage.namePlaceholder',
|
||||
defaultMessage: 'My Application',
|
||||
},
|
||||
descriptionLabel: {
|
||||
id: 'settings-manager.components.HomePage.descriptionLabel',
|
||||
defaultMessage: 'Description',
|
||||
},
|
||||
descriptionPlaceholder: {
|
||||
id: 'settings-manager.components.HomePage.descriptionPlaceholder',
|
||||
defaultMessage: 'A Strapi application',
|
||||
},
|
||||
versionLabel: {
|
||||
id: 'settings-manager.components.HomePage.versionLabel',
|
||||
defaultMessage: 'Version',
|
||||
},
|
||||
versionPlaceholder: {
|
||||
id: 'settings-manager.components.HomePage.versionPlaceholder',
|
||||
defaultMessage: '0.0.1',
|
||||
},
|
||||
submit: {
|
||||
id: 'settings-manager.components.HomePage.submit',
|
||||
defaultMessage: 'Submit',
|
||||
},
|
||||
});
|
42
public/app/containers/HomePage/messages.json
Normal file
42
public/app/containers/HomePage/messages.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"rightSectionDescription": {
|
||||
"id": "settings-manager.components.HomePage.rightSectionDescription",
|
||||
"defaultMessage": "Configure your general settings"
|
||||
},
|
||||
"rightContentSectionTitle": {
|
||||
"id": "settings-manager.components.HomePage.rightContentSectionTitle",
|
||||
"defaultMessage": "Application"
|
||||
},
|
||||
"rightContentSectionDescription": {
|
||||
"id": "settings-manager.components.HomePage.rightContentSectionDescription",
|
||||
"defaultMessage": "The general settings of your Strapi application."
|
||||
},
|
||||
"nameLabel": {
|
||||
"id": "settings-manager.components.HomePage.nameLabel",
|
||||
"defaultMessage": "Name"
|
||||
},
|
||||
"namePlaceholder": {
|
||||
"id": "settings-manager.components.HomePage.namePlaceholder",
|
||||
"defaultMessage": "My Application"
|
||||
},
|
||||
"descriptionLabel": {
|
||||
"id": "settings-manager.components.HomePage.descriptionLabel",
|
||||
"defaultMessage": "Description"
|
||||
},
|
||||
"descriptionPlaceholder": {
|
||||
"id": "settings-manager.components.HomePage.descriptionPlaceholder",
|
||||
"defaultMessage": "A Strapi application"
|
||||
},
|
||||
"versionLabel": {
|
||||
"id": "settings-manager.components.HomePage.versionLabel",
|
||||
"defaultMessage": "Version"
|
||||
},
|
||||
"versionPlaceholder": {
|
||||
"id": "settings-manager.components.HomePage.versionPlaceholder",
|
||||
"defaultMessage": "0.0.1"
|
||||
},
|
||||
"submit": {
|
||||
"id": "settings-manager.components.HomePage.submit",
|
||||
"defaultMessage": "Submit"
|
||||
}
|
||||
}
|
@ -9,8 +9,10 @@ import Container from 'components/Container';
|
||||
import RightContentTitle from 'components/RightContentTitle';
|
||||
import RightContentSectionTitle from 'components/RightContentSectionTitle';
|
||||
import { injectIntl, intlShape } from 'react-intl';
|
||||
import appMessages from 'containers/App/messages';
|
||||
import messages from './messages';
|
||||
import appMessages from 'containers/App/messages.json';
|
||||
import messages from './messages.json';
|
||||
import { define } from '../../i18n';
|
||||
define(messages);
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* LanguagesPage Messages
|
||||
*
|
||||
* This contains all the text for the LanguagesPage component.
|
||||
*/
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
export default defineMessages({
|
||||
rightSectionDescription: {
|
||||
id: 'settings-manager.components.LanguagesPage.rightSectionDescription',
|
||||
defaultMessage: 'Configure your languages settings',
|
||||
},
|
||||
});
|
6
public/app/containers/LanguagesPage/messages.json
Normal file
6
public/app/containers/LanguagesPage/messages.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"rightSectionDescription": {
|
||||
"id": "settings-manager.components.LanguagesPage.rightSectionDescription",
|
||||
"defaultMessage": "Configure your languages settings"
|
||||
}
|
||||
}
|
@ -9,8 +9,10 @@ import Container from 'components/Container';
|
||||
import RightContentTitle from 'components/RightContentTitle';
|
||||
import RightContentSectionTitle from 'components/RightContentSectionTitle';
|
||||
import { injectIntl, intlShape } from 'react-intl';
|
||||
import appMessages from 'containers/App/messages';
|
||||
import messages from './messages';
|
||||
import appMessages from 'containers/App/messages.json';
|
||||
import messages from './messages.json';
|
||||
import { define } from '../../i18n';
|
||||
define(messages);
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* LanguagesPage Messages
|
||||
*
|
||||
* This contains all the text for the LanguagesPage component.
|
||||
*/
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
export default defineMessages({
|
||||
rightSectionDescription: {
|
||||
id: 'settings-manager.components.SecurityPage.rightSectionDescription',
|
||||
defaultMessage: 'Configure your security settings',
|
||||
},
|
||||
});
|
6
public/app/containers/SecurityPage/messages.json
Normal file
6
public/app/containers/SecurityPage/messages.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"rightSectionDescription": {
|
||||
"id": "settings-manager.components.SecurityPage.rightSectionDescription",
|
||||
"defaultMessage": "Configure your security settings"
|
||||
}
|
||||
}
|
@ -9,8 +9,10 @@ import Container from 'components/Container';
|
||||
import RightContentTitle from 'components/RightContentTitle';
|
||||
import RightContentSectionTitle from 'components/RightContentSectionTitle';
|
||||
import { injectIntl, intlShape } from 'react-intl';
|
||||
import appMessages from 'containers/App/messages';
|
||||
import messages from './messages';
|
||||
import appMessages from 'containers/App/messages.json';
|
||||
import messages from './messages.json';
|
||||
import { define } from '../../i18n';
|
||||
define(messages);
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*
|
||||
* LanguagesPage Messages
|
||||
*
|
||||
* This contains all the text for the LanguagesPage component.
|
||||
*/
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
export default defineMessages({
|
||||
rightSectionDescription: {
|
||||
id: 'settings-manager.components.ServerPage.rightSectionDescription',
|
||||
defaultMessage: 'Configure your server settings',
|
||||
},
|
||||
});
|
6
public/app/containers/ServerPage/messages.json
Normal file
6
public/app/containers/ServerPage/messages.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"rightSectionDescription": {
|
||||
"id": "settings-manager.components.ServerPage.rightSectionDescription",
|
||||
"defaultMessage": "Configure your server settings"
|
||||
}
|
||||
}
|
@ -4,33 +4,22 @@
|
||||
* This will setup the i18n language files and locale data for your plugin.
|
||||
*
|
||||
*/
|
||||
// import { addLocaleData } from 'react-intl';
|
||||
|
||||
// import enLocaleData from 'react-intl/locale-data/en';
|
||||
// import frLocaleData from 'react-intl/locale-data/fr';
|
||||
|
||||
// export const appLocales = [
|
||||
// 'en',
|
||||
// 'fr',
|
||||
//
|
||||
// ];
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import enTranslationMessages from './translations/en.json';
|
||||
import frTranslationMessages from './translations/fr.json';
|
||||
|
||||
// addLocaleData(enLocaleData);
|
||||
// addLocaleData(frLocaleData);
|
||||
|
||||
const formatTranslationMessages = (messages) => {
|
||||
const formattedMessages = {};
|
||||
for (const message of messages) {
|
||||
formattedMessages[message.id] = message.message || message.defaultMessage;
|
||||
}
|
||||
|
||||
return formattedMessages;
|
||||
const translationMessages = {
|
||||
en: enTranslationMessages,
|
||||
fr: frTranslationMessages,
|
||||
};
|
||||
|
||||
export const translationMessages = {
|
||||
en: formatTranslationMessages(enTranslationMessages),
|
||||
fr: formatTranslationMessages(frTranslationMessages),
|
||||
const define = messages => {
|
||||
defineMessages(messages);
|
||||
};
|
||||
|
||||
export {
|
||||
translationMessages,
|
||||
define,
|
||||
};
|
||||
|
@ -1,152 +1,28 @@
|
||||
[
|
||||
{
|
||||
"id": "app.components.LocaleToggle.de",
|
||||
"defaultMessage": "de",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "app.components.LocaleToggle.en",
|
||||
"defaultMessage": "en",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.components.Footer.author.message",
|
||||
"defaultMessage": "Made with love by {author}.",
|
||||
"message": "Mit Liebe gemacht von {author}."
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.components.Footer.license.message",
|
||||
"defaultMessage": "This project is licensed under the MIT license.",
|
||||
"message": "Dieses Projekt wird unter der MIT-Lizenz veröffentlicht."
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.css.header",
|
||||
"defaultMessage": "Features",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.css.message",
|
||||
"defaultMessage": "Next generation CSS",
|
||||
"message": "Die nächste Generation von CSS"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.feedback.header",
|
||||
"defaultMessage": "Instant feedback",
|
||||
"message": "Sofortiges Feedback"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.feedback.message",
|
||||
"defaultMessage": "Enjoy the best DX and code your app at the speed of thought! Your\n saved changes to the CSS and JS are reflected instantaneously\n without refreshing the page. Preserve application state even when\n you update something in the underlying code!",
|
||||
"message": "Genießen Sie die beste Entwicklungserfahrung und programmieren Sie Ihre App so schnell wie noch nie! Ihre Änderungen an dem CSS und JavaScript sind sofort reflektiert, ohne die Seite aktualisieren zu müssen. So bleibt der Anwendungszustand bestehen, auch wenn Sie etwas in dem darunter liegenden Code aktualisieren!"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.header",
|
||||
"defaultMessage": "Features",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.home",
|
||||
"defaultMessage": "Home",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.internationalization.header",
|
||||
"defaultMessage": "Complete i18n Standard Internationalization & Pluralization",
|
||||
"message": "Komplette i18n Standard-Internationalisierung und Pluralisierung"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.internationalization.message",
|
||||
"defaultMessage": "Scalable apps need to support multiple languages, easily add and support multiple languages with `react-intl`.",
|
||||
"message": "Das Internet ist global. Mehrsprachige- und Pluralisierungsunterstützung ist entscheidend für große Web-Anwendungen."
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.javascript.header",
|
||||
"defaultMessage": "Next generation JavaScript",
|
||||
"message": "Die nächste Generation von JavaScript"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.javascript.message",
|
||||
"defaultMessage": "Use template strings, object destructuring, arrow functions, JSX\n syntax and more, today.",
|
||||
"message": "Benutzen Sie ES6 template strings, object destructuring, arrow functions, JSX syntax und mehr, heute."
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.network.header",
|
||||
"defaultMessage": "Offline-first",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.network.message",
|
||||
"defaultMessage": "The next frontier in performant web apps: availability without a\n network connection from the instant your users load the app.",
|
||||
"message": "Die nächste Schwelle für performanten Web-Anwendungen: Verfügbarkeit ohne Netzwerkverbindung wenn Ihre Benutzer die App einmal heruntergeladen haben."
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.routing.header",
|
||||
"defaultMessage": "Industry-standard routing",
|
||||
"message": "Standard Routing"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.routing.message",
|
||||
"defaultMessage": "Write composable CSS that's co-located with your components for\n complete modularity. Unique generated class names keep the\n specificity low while eliminating style clashes. Ship only the\n styles that are on the page for the best performance.",
|
||||
"message": "Schreiben Sie CSS, das am selben Ort wie ihre Komponenten ist. Deterministisch generierte, einzigartige Klassennamen halten die Spezifität niedrig während styling Konflikte vermieden werden. Senden Sie nur das CSS an ihre Benutzer welches dann wirklich sichtbar ist für die schnellste Performance!"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.scaffolding.header",
|
||||
"defaultMessage": "Quick scaffolding",
|
||||
"message": "Schnelles Scaffolding"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.scaffolding.message",
|
||||
"defaultMessage": "Automate the creation of components, containers, routes, selectors\n and sagas - and their tests - right from the CLI!",
|
||||
"message": "Automatisieren Sie die Kreation von Komponenten, Containern, Routen, Selektoren und Sagas – und ihre Tests – direkt von dem Terminal!"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.state_management.header",
|
||||
"defaultMessage": "Predictable state management",
|
||||
"message": "Berechenbare Stateverwaltung"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.FeaturePage.state_management.message",
|
||||
"defaultMessage": "Unidirectional data flow allows for change logging and time travel\n debugging.",
|
||||
"message": "Unidirectional data flow erlaubt uns alle Änderungen ihrer Applikation zu loggen und time travel debugging einzusetzen."
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.HomePage.features.Button",
|
||||
"defaultMessage": "Features",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.HomePage.start_project.header",
|
||||
"defaultMessage": "Start your next react project in seconds",
|
||||
"message": "Beginnen Sie Ihr nächstes React Projekt in Sekunden"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.HomePage.start_project.message",
|
||||
"defaultMessage": "A highly scalable, offline-first foundation with the best DX and a focus on performance and best practices",
|
||||
"message": "Ein skalierendes, offline-first Fundament mit der besten DX und einem Fokus auf Performance und bewährte Methoden"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.HomePage.tryme.atPrefix",
|
||||
"defaultMessage": "@",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.HomePage.tryme.header",
|
||||
"defaultMessage": "Try me!",
|
||||
"message": "Probiere mich!"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.HomePage.tryme.message",
|
||||
"defaultMessage": "Show Github repositories by",
|
||||
"message": "Zeige die Github Repositories von"
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.NotFoundPage.header",
|
||||
"defaultMessage": "Page not found.",
|
||||
"message": "Seite nicht gefunden."
|
||||
},
|
||||
{
|
||||
"id": "boilerplate.containers.NotFoundPage.home",
|
||||
"defaultMessage": "Home",
|
||||
"message": ""
|
||||
"settings-manager.components.AdvancedPage.rightSectionDescription": "",
|
||||
"settings-manager.components.App.advancedSectionTitle": "",
|
||||
"settings-manager.components.App.comingSoon": "",
|
||||
"settings-manager.components.App.databasesSectionTitle": "",
|
||||
"settings-manager.components.App.generalSectionTitle": "",
|
||||
"settings-manager.components.App.languagesSectionTitle": "",
|
||||
"settings-manager.components.App.securitySectionTitle": "",
|
||||
"settings-manager.components.App.serverSectionTitle": "",
|
||||
"settings-manager.components.DatabasesPage.rightSectionDescription": "",
|
||||
"settings-manager.components.HomePage.descriptionLabel": "",
|
||||
"settings-manager.components.HomePage.descriptionPlaceholder": "",
|
||||
"settings-manager.components.HomePage.nameLabel": "",
|
||||
"settings-manager.components.HomePage.namePlaceholder": "",
|
||||
"settings-manager.components.HomePage.rightContentSectionDescription": "",
|
||||
"settings-manager.components.HomePage.rightContentSectionTitle": "",
|
||||
"settings-manager.components.HomePage.rightSectionDescription": "",
|
||||
"settings-manager.components.HomePage.submit": "",
|
||||
"settings-manager.components.HomePage.versionLabel": "",
|
||||
"settings-manager.components.HomePage.versionPlaceholder": "",
|
||||
"settings-manager.components.LanguagesPage.rightSectionDescription": "",
|
||||
"settings-manager.components.PluginHeaderActions.cancelLabel": "",
|
||||
"settings-manager.components.PluginHeaderActions.saveLabel": "",
|
||||
"settings-manager.components.PluginHeaderTitle.description": "",
|
||||
"settings-manager.components.PluginHeaderTitle.title": "",
|
||||
"settings-manager.components.SecurityPage.rightSectionDescription": "",
|
||||
"settings-manager.components.ServerPage.rightSectionDescription": ""
|
||||
}
|
||||
]
|
||||
|
@ -1,16 +1,28 @@
|
||||
[
|
||||
{
|
||||
"id": "app.components.DatabasesPage.header",
|
||||
"defaultMessage": "This is the Databases page of the Settings Manager plugin!",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "app.components.NotFoundPage.pageNotFound",
|
||||
"defaultMessage": "Page not found.",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "settings-manager.components.HomePage.header",
|
||||
"defaultMessage": "This is HomePage components !"
|
||||
"settings-manager.components.AdvancedPage.rightSectionDescription": "",
|
||||
"settings-manager.components.App.advancedSectionTitle": "",
|
||||
"settings-manager.components.App.comingSoon": "",
|
||||
"settings-manager.components.App.databasesSectionTitle": "",
|
||||
"settings-manager.components.App.generalSectionTitle": "",
|
||||
"settings-manager.components.App.languagesSectionTitle": "",
|
||||
"settings-manager.components.App.securitySectionTitle": "",
|
||||
"settings-manager.components.App.serverSectionTitle": "",
|
||||
"settings-manager.components.DatabasesPage.rightSectionDescription": "",
|
||||
"settings-manager.components.HomePage.descriptionLabel": "",
|
||||
"settings-manager.components.HomePage.descriptionPlaceholder": "",
|
||||
"settings-manager.components.HomePage.nameLabel": "",
|
||||
"settings-manager.components.HomePage.namePlaceholder": "",
|
||||
"settings-manager.components.HomePage.rightContentSectionDescription": "",
|
||||
"settings-manager.components.HomePage.rightContentSectionTitle": "",
|
||||
"settings-manager.components.HomePage.rightSectionDescription": "",
|
||||
"settings-manager.components.HomePage.submit": "",
|
||||
"settings-manager.components.HomePage.versionLabel": "",
|
||||
"settings-manager.components.HomePage.versionPlaceholder": "",
|
||||
"settings-manager.components.LanguagesPage.rightSectionDescription": "",
|
||||
"settings-manager.components.PluginHeaderActions.cancelLabel": "",
|
||||
"settings-manager.components.PluginHeaderActions.saveLabel": "",
|
||||
"settings-manager.components.PluginHeaderTitle.description": "",
|
||||
"settings-manager.components.PluginHeaderTitle.title": "",
|
||||
"settings-manager.components.SecurityPage.rightSectionDescription": "",
|
||||
"settings-manager.components.ServerPage.rightSectionDescription": ""
|
||||
}
|
||||
]
|
||||
|
@ -1,16 +1,28 @@
|
||||
[
|
||||
{
|
||||
"id": "app.components.DatabasesPage.header",
|
||||
"defaultMessage": "This is the Databases page of the Settings Manager plugin!",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "app.components.NotFoundPage.pageNotFound",
|
||||
"defaultMessage": "Page not found.",
|
||||
"message": ""
|
||||
},
|
||||
{
|
||||
"id": "settings-manager.components.HomePage.header",
|
||||
"defaultMessage": "Ceci est la page d'accueil!"
|
||||
"settings-manager.components.AdvancedPage.rightSectionDescription": "",
|
||||
"settings-manager.components.App.advancedSectionTitle": "",
|
||||
"settings-manager.components.App.comingSoon": "",
|
||||
"settings-manager.components.App.databasesSectionTitle": "",
|
||||
"settings-manager.components.App.generalSectionTitle": "",
|
||||
"settings-manager.components.App.languagesSectionTitle": "",
|
||||
"settings-manager.components.App.securitySectionTitle": "",
|
||||
"settings-manager.components.App.serverSectionTitle": "",
|
||||
"settings-manager.components.DatabasesPage.rightSectionDescription": "",
|
||||
"settings-manager.components.HomePage.descriptionLabel": "",
|
||||
"settings-manager.components.HomePage.descriptionPlaceholder": "",
|
||||
"settings-manager.components.HomePage.nameLabel": "",
|
||||
"settings-manager.components.HomePage.namePlaceholder": "",
|
||||
"settings-manager.components.HomePage.rightContentSectionDescription": "",
|
||||
"settings-manager.components.HomePage.rightContentSectionTitle": "",
|
||||
"settings-manager.components.HomePage.rightSectionDescription": "",
|
||||
"settings-manager.components.HomePage.submit": "",
|
||||
"settings-manager.components.HomePage.versionLabel": "",
|
||||
"settings-manager.components.HomePage.versionPlaceholder": "",
|
||||
"settings-manager.components.LanguagesPage.rightSectionDescription": "",
|
||||
"settings-manager.components.PluginHeaderActions.cancelLabel": "",
|
||||
"settings-manager.components.PluginHeaderActions.saveLabel": "",
|
||||
"settings-manager.components.PluginHeaderTitle.description": "",
|
||||
"settings-manager.components.PluginHeaderTitle.title": "",
|
||||
"settings-manager.components.SecurityPage.rightSectionDescription": "",
|
||||
"settings-manager.components.ServerPage.rightSectionDescription": ""
|
||||
}
|
||||
]
|
||||
|
@ -10,7 +10,7 @@ const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
||||
const dllPlugin = pkg.dllPlugin;
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
const pluginId = pkg.name.replace(/^strapi-/i, '');
|
||||
|
||||
const _ = require('lodash');
|
||||
// PostCSS plugins
|
||||
const cssnext = require('postcss-cssnext');
|
||||
const postcssFocus = require('postcss-focus');
|
||||
@ -62,6 +62,9 @@ module.exports = require('./webpack.base.babel')({
|
||||
|
||||
// Emit a source map for easier debugging
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
|
||||
// Generate translations files
|
||||
generateTranslationFiles: generateTranslationFiles(),
|
||||
});
|
||||
|
||||
/**
|
||||
@ -75,7 +78,9 @@ module.exports = require('./webpack.base.babel')({
|
||||
*/
|
||||
function dependencyHandlers() {
|
||||
// Don't do anything during the DLL Build step
|
||||
if (process.env.BUILDING_DLL) { return []; }
|
||||
if (process.env.BUILDING_DLL) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// If the package.json does not have a dllPlugin property, use the CommonsChunkPlugin
|
||||
if (!dllPlugin) {
|
||||
@ -133,3 +138,160 @@ function dependencyHandlers() {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate translation files according
|
||||
* to `messages.json` included in the app.
|
||||
*/
|
||||
function generateTranslationFiles() {
|
||||
// App directory
|
||||
const appDirectory = path.resolve(process.cwd(), 'app');
|
||||
|
||||
// Find `message.json` files in the app
|
||||
findMessagesFiles(appDirectory, (err, messageFiles) => {
|
||||
if (err) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Format messages found
|
||||
const messagesFormatted = formatMessages(messageFiles);
|
||||
|
||||
// Get the list of languages supported by this plugin
|
||||
const pluginLanguages = getPluginLanguages();
|
||||
|
||||
// Get current translations values
|
||||
const currentTranslationsValues = getCurrentTranslationsValues(pluginLanguages);
|
||||
|
||||
// Update translations values
|
||||
const updatedTranslationValues = getUpdatedTranslationValues(currentTranslationsValues, messagesFormatted);
|
||||
|
||||
// Write files according to updated translations values
|
||||
writeTranslationFiles(pluginLanguages, updatedTranslationValues);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Find `message.json` files in the app.
|
||||
*
|
||||
* @param cb {Function} Callback
|
||||
*/
|
||||
function findMessagesFiles(appDir, cb) {
|
||||
// Name of the messages files
|
||||
const messagesFileName = 'messages.json';
|
||||
|
||||
// App directory
|
||||
// const dir = path.resolve(process.cwd(), 'app');
|
||||
|
||||
// Results
|
||||
let results = {};
|
||||
|
||||
// Parallel search
|
||||
fs.readdir(appDir, (err, list) => {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
let pending = list.length;
|
||||
if (!pending) {
|
||||
return cb(null, results);
|
||||
}
|
||||
return list.forEach(fileName => {
|
||||
const filePath = path.resolve(appDir, fileName);
|
||||
fs.stat(filePath, (errStat, stat) => {
|
||||
if (stat && stat.isDirectory()) {
|
||||
findMessagesFiles(filePath, (errFind, res) => {
|
||||
// Merge with the previous results
|
||||
results = _.merge(results, res);
|
||||
if (!--pending) {
|
||||
cb(null, results);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (fileName === messagesFileName) {
|
||||
results[filePath] = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
||||
}
|
||||
if (!--pending) {
|
||||
cb(null, results);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of languages supported by the plugin.
|
||||
*
|
||||
* @returns {Array} List of languages support by the plugin
|
||||
*/
|
||||
function getPluginLanguages() {
|
||||
return fs.readdirSync(path.resolve(process.cwd(), 'app', 'translations')).map(fileName => (fileName.replace('.json', '')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of current translations values.
|
||||
*
|
||||
* @param languages {Array} List of languages support by the plugin
|
||||
* @returns {Object} Current translation values
|
||||
*/
|
||||
function getCurrentTranslationsValues(languages) {
|
||||
const currentTranslationsValues = {};
|
||||
|
||||
_.forEach(languages, language => {
|
||||
currentTranslationsValues[language] = JSON.parse(fs.readFileSync((path.resolve(process.cwd(), 'app', 'translations', `${language}.json`)), 'utf8'));
|
||||
});
|
||||
|
||||
return currentTranslationsValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format messages.
|
||||
*
|
||||
* @param messageFiles {Object}
|
||||
* @returns {Object} Messages formatted
|
||||
*/
|
||||
function formatMessages(messageFiles) {
|
||||
const messagesFormatted = {};
|
||||
|
||||
_.forEach(messageFiles, messageFile => {
|
||||
_.forEach(messageFile, message => {
|
||||
messagesFormatted[message.id] = message.defaultMessage;
|
||||
});
|
||||
});
|
||||
|
||||
return messagesFormatted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge current translations with new ones.
|
||||
*
|
||||
* @param currentTranslationsValues {Object} Current translations value
|
||||
* @param messagesFormatted {Object} Messages formatted from `messages.json` files
|
||||
* @returns {Object} Translations values updated
|
||||
*/
|
||||
function getUpdatedTranslationValues(currentTranslationsValues, messagesFormatted) {
|
||||
const updatedTranslationValues = {};
|
||||
|
||||
_.forEach(currentTranslationsValues, (value, language) => {
|
||||
updatedTranslationValues[language] = {};
|
||||
|
||||
// Sort the messages and assigns the values
|
||||
Object.keys(messagesFormatted).sort().forEach(id => {
|
||||
updatedTranslationValues[language][id] = currentTranslationsValues[language][id] || '';
|
||||
});
|
||||
});
|
||||
|
||||
return updatedTranslationValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrite translations files according to updated values
|
||||
*
|
||||
* @param languages {Array} The list of languages supported by the plugin
|
||||
* @param updatedTranslationValues {Object} Translations values updated
|
||||
*/
|
||||
function writeTranslationFiles(languages, updatedTranslationValues) {
|
||||
_.forEach(languages, (language) => {
|
||||
fs.writeFileSync(path.resolve(path.resolve(process.cwd(), 'app', 'translations', `${language}.json`)), JSON.stringify(updatedTranslationValues[language], null, 2));
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user