aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/i18n
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-10-30 22:11:00 +0200
committerArmand Philippot <git@armandphilippot.com>2021-10-30 22:52:23 +0200
commit3a3baddad1c801d77dc398d2c6980f3c14f4a47c (patch)
tree9e06aef730504470111c010e53a1857f7b01ab83 /src/js/i18n
parentc3045b163e74b42c0a0e71c646740c76d3bb5ba1 (diff)
chore: move htdocs to repo root
Diffstat (limited to 'src/js/i18n')
-rw-r--r--src/js/i18n/i18n.js42
-rw-r--r--src/js/i18n/locales/en.js36
-rw-r--r--src/js/i18n/locales/fr.js36
3 files changed, 114 insertions, 0 deletions
diff --git a/src/js/i18n/i18n.js b/src/js/i18n/i18n.js
new file mode 100644
index 0000000..6bdc7cd
--- /dev/null
+++ b/src/js/i18n/i18n.js
@@ -0,0 +1,42 @@
+import I18n from 'i18n-js';
+import en from './locales/en';
+import fr from './locales/fr';
+
+const supportedLanguages = [
+ {
+ code: 'en',
+ label: 'English',
+ translations: en,
+ },
+ {
+ code: 'fr',
+ label: 'Français',
+ translations: fr,
+ },
+];
+
+supportedLanguages.forEach((locale) => {
+ I18n.translations[locale.code] = locale.translations;
+});
+
+function setLocale(locale) {
+ I18n.locale = locale;
+}
+
+function currentLocale() {
+ return I18n.currentLocale();
+}
+
+function translate(name, params = {}) {
+ return I18n.t(name, params);
+}
+
+const { defaultLocale } = I18n;
+
+export {
+ supportedLanguages,
+ setLocale,
+ translate,
+ defaultLocale,
+ currentLocale,
+};
diff --git a/src/js/i18n/locales/en.js b/src/js/i18n/locales/en.js
new file mode 100644
index 0000000..9717528
--- /dev/null
+++ b/src/js/i18n/locales/en.js
@@ -0,0 +1,36 @@
+const en = {
+ branding: {
+ description: 'Front-end developer',
+ },
+ nav: {
+ title: 'Apps list:',
+ },
+ main: {
+ instructions:
+ 'Select an app inside menu to see a live preview and app details (description, technologies, repositories).',
+ project: {
+ details: {
+ about: 'About {{name}}',
+ repo: {
+ one: 'Repository:',
+ other: 'Repositories:',
+ zero: 'Repositories:',
+ },
+ tech: {
+ one: 'Technology:',
+ other: 'Technologies:',
+ zero: 'Technologies:',
+ },
+ },
+ },
+ },
+ footer: {
+ legalNotice: {
+ txt: 'Legal notice',
+ link: 'legal-notice.html',
+ },
+ license: 'License MIT',
+ },
+};
+
+export default en;
diff --git a/src/js/i18n/locales/fr.js b/src/js/i18n/locales/fr.js
new file mode 100644
index 0000000..9c93012
--- /dev/null
+++ b/src/js/i18n/locales/fr.js
@@ -0,0 +1,36 @@
+const fr = {
+ branding: {
+ description: 'Intégrateur web',
+ },
+ nav: {
+ title: 'Liste des applications :',
+ },
+ main: {
+ instructions:
+ "Sélectionnez une application dans le menu pour afficher un aperçu en direct et les informations sur l'application (description, technologies, dépôts).",
+ project: {
+ details: {
+ about: 'À propos de {{name}}',
+ repo: {
+ one: 'Dépôt :',
+ other: 'Dépôts :',
+ zero: 'Dépôt :',
+ },
+ tech: {
+ one: 'Technologie :',
+ other: 'Technologies :',
+ zero: 'Technologie :',
+ },
+ },
+ },
+ },
+ footer: {
+ legalNotice: {
+ txt: 'Mentions légales',
+ link: 'mentions-legales.html',
+ },
+ license: 'Licence MIT',
+ },
+};
+
+export default fr;