Browse Source

Merge branch 'develop' of github.com:tracim/tracim_v2 into develop

AlexiCauvin 6 years ago
parent
commit
203d0bf31e

+ 16 - 0
frontend/i18next.scanner.js View File

@@ -0,0 +1,16 @@
1
+const scanner = require('i18next-scanner')
2
+const vfs = require('vinyl-fs')
3
+
4
+const option = require('../i18next.option.js')
5
+
6
+// this script is run by npm run build-translation and generate i18next.scanner/**/*.json
7
+
8
+// --------------------
9
+// 2018/07/27 - currently, last version is 2.6.5 but a bug is spaming log with errors. So I'm using 2.6.1
10
+// this issue seems related : https://github.com/i18next/i18next-scanner/issues/88
11
+// --------------------
12
+
13
+vfs.src(['./src/**/*.jsx'])
14
+  // .pipe(sort()) // Sort files in stream by path
15
+  .pipe(scanner(option))
16
+  .pipe(vfs.dest('./i18next.scanner'))

+ 13 - 0
frontend/i18next.scanner/en/translation.json View File

@@ -0,0 +1,13 @@
1
+{
2
+  "Create your own collaborative workspaces on trac.im": "Create your own collaborative workspaces on trac.im",
3
+  "Copyright 2013 - 2017": "Copyright 2013 - 2017",
4
+  "Disconnection error": "Disconnection error",
5
+  "Create new workspace": "Create new workspace",
6
+  "Error": "Error",
7
+  "Email or password invalid": "Email or password invalid",
8
+  "Type": "Type",
9
+  "Document's name": "Document's name",
10
+  "Status": "Status",
11
+  "Create in folder...": "Create in folder...",
12
+  "Search...": "Search..."
13
+}

+ 13 - 0
frontend/i18next.scanner/fr/translation.json View File

@@ -0,0 +1,13 @@
1
+{
2
+  "Create your own collaborative workspaces on trac.im": "Créer votre propre espace de travail sur trac.im",
3
+  "Copyright 2013 - 2017": "Copyright 2013 - 2017",
4
+  "Disconnection error": "Erreur de déconnexion",
5
+  "Create new workspace": "Créer un espace de travail",
6
+  "Error": "Erreur",
7
+  "Email or password invalid": "Email ou mot de passe invalid",
8
+  "Type": "Type",
9
+  "Document's name": "Nom du document",
10
+  "Status": "Statut",
11
+  "Create in folder...": "Créer dans le dossier ...",
12
+  "Search...": "Rechercher ..."
13
+}

+ 17 - 0
frontend_app_html-document/build_html-document.sh View File

@@ -0,0 +1,17 @@
1
+#!/bin/bash
2
+
3
+. ../bash_library.sh # source bash_library.sh
4
+
5
+windoz=""
6
+if [[ $1 = "-w" ]]; then
7
+    windoz="windoz"
8
+fi
9
+
10
+log "npm run build$windoz"
11
+npm run build$windoz
12
+log "cp dist/html-document.app.js ../frontend/dist/app"
13
+cp dist/html-document.app.js ../frontend/dist/app
14
+log "cp i18next.scanner/en/translation.json ../frontend/dist/app/html-document_en_translation.json"
15
+cp i18next.scanner/en/translation.json ../frontend/dist/app/html-document_en_translation.json
16
+log "cp i18next.scanner/fr/translation.json ../frontend/dist/app/html-document_fr_translation.json"
17
+cp i18next.scanner/fr/translation.json ../frontend/dist/app/html-document_fr_translation.json

+ 14 - 0
frontend_app_html-document/i18next.scanner.js View File

@@ -0,0 +1,14 @@
1
+const scanner = require('i18next-scanner')
2
+const vfs = require('vinyl-fs')
3
+
4
+const option = require('../i18next.option.js')
5
+
6
+// --------------------
7
+// 2018/07/27 - currently, last version is 2.6.5 but a bug is spaming log with errors. So I'm using 2.6.1
8
+// this issue seems related : https://github.com/i18next/i18next-scanner/issues/88
9
+// --------------------
10
+
11
+vfs.src(['./src/**/*.jsx'])
12
+// .pipe(sort()) // Sort files in stream by path
13
+  .pipe(scanner(option))
14
+  .pipe(vfs.dest('./i18next.scanner'))

+ 3 - 0
frontend_app_html-document/i18next.scanner/en/translation.json View File

@@ -0,0 +1,3 @@
1
+{
2
+  "Last version": "Last version"
3
+}

+ 3 - 0
frontend_app_html-document/i18next.scanner/fr/translation.json View File

@@ -0,0 +1,3 @@
1
+{
2
+  "Last version": "Dernière version"
3
+}

+ 17 - 0
frontend_app_thread/build_thread.sh View File

@@ -0,0 +1,17 @@
1
+#!/bin/bash
2
+
3
+. ../bash_library.sh # source bash_library.sh
4
+
5
+windoz=""
6
+if  [[ $1 = "-w" ]]; then
7
+    windoz="windoz"
8
+fi
9
+
10
+log "npm run build$windoz"
11
+npm run build$windoz
12
+log "cp dist/thread.app.js ../frontend/dist/app"
13
+cp dist/thread.app.js ../frontend/dist/app
14
+log "cp i18next.scanner/en/translation.json ../frontend/dist/app/thread_en_translation.json"
15
+cp i18next.scanner/en/translation.json ../frontend/dist/app/thread_en_translation.json
16
+log "cp i18next.scanner/fr/translation.json ../frontend/dist/app/thread_fr_translation.json"
17
+cp i18next.scanner/fr/translation.json ../frontend/dist/app/thread_fr_translation.json

+ 14 - 0
frontend_app_thread/i18next.scanner.js View File

@@ -0,0 +1,14 @@
1
+const scanner = require('i18next-scanner')
2
+const vfs = require('vinyl-fs')
3
+
4
+const option = require('../i18next.option.js')
5
+
6
+// --------------------
7
+// 2018/07/27 - currently, last version is 2.6.5 but a bug is spaming log with errors. So I'm using 2.6.1
8
+// this issue seems related : https://github.com/i18next/i18next-scanner/issues/88
9
+// --------------------
10
+
11
+vfs.src(['./src/**/*.jsx'])
12
+// .pipe(sort()) // Sort files in stream by path
13
+  .pipe(scanner(option))
14
+  .pipe(vfs.dest('./i18next.scanner'))

+ 1 - 0
frontend_app_thread/i18next.scanner/en/translation.json View File

@@ -0,0 +1 @@
1
+{}

+ 1 - 0
frontend_app_thread/i18next.scanner/fr/translation.json View File

@@ -0,0 +1 @@
1
+{}

+ 9 - 0
frontend_lib/i18next.scanner.js View File

@@ -0,0 +1,9 @@
1
+const scanner = require('i18next-scanner')
2
+const vfs = require('vinyl-fs')
3
+
4
+const option = require('../i18next.option.js')
5
+
6
+vfs.src(['./src/**/*.jsx'])
7
+// .pipe(sort()) // Sort files in stream by path
8
+  .pipe(scanner(option))
9
+  .pipe(vfs.dest('./i18next.scanner'))

+ 3 - 0
frontend_lib/i18next.scanner/en/translation.json View File

@@ -0,0 +1,3 @@
1
+{
2
+  "File status": "File status"
3
+}

+ 3 - 0
frontend_lib/i18next.scanner/fr/translation.json View File

@@ -0,0 +1,3 @@
1
+{
2
+  "File status": "__NOT_TRANSLATED__"
3
+}

+ 40 - 0
i18next.option.js View File

@@ -0,0 +1,40 @@
1
+module.exports = {
2
+  debug: true,
3
+  removeUnusedKeys: true,
4
+  func: {
5
+    list: ['t', 'props.t', 'this.props.t'],
6
+    extensions: ['.js', '.jsx']
7
+  },
8
+  lngs: ['en', 'fr'],
9
+  defaultLng: 'en',
10
+  keySeparator: false, // false means "keyBasedFallback"
11
+  nsSeparator: false, // false means "keyBasedFallback"
12
+  fallbackLng: false,
13
+
14
+  ns: ['translation'], // namespace
15
+  defaultNS: 'translation',
16
+
17
+  // @param {string} lng The language currently used.
18
+  // @param {string} ns The namespace currently used.
19
+  // @param {string} key The translation key.
20
+  // @return {string} Returns a default value for the translation key.
21
+  // Return key as the default value for English language. Otherwise, returns '__NOT_TRANSLATED__'
22
+  defaultValue: (lng, ns, key) => lng === 'en' ? key : '__NOT_TRANSLATED__',
23
+
24
+  react: {wait: true},
25
+
26
+  resource: {
27
+    // The path where resources get loaded from.
28
+    // /!\ /!\ /!\ Relative to CURRENT working directory. /!\
29
+    loadPath: 'i18next.scanner/{{lng}}/{{ns}}.json',
30
+    // The path to store resources.
31
+    // /!\ /!\ /!\ Relative to the path specified by `vfs.dest('./i18next.scanner')`. /!\
32
+    savePath: '{{lng}}/{{ns}}.json',
33
+    jsonIndent: 2,
34
+    lineEnding: '\n'
35
+  },
36
+  // interpolation: {
37
+  //   escapeValue: false, // not needed for react!!
38
+  // },
39
+  trans: false,
40
+}