diff --git a/CliClient/.gitignore b/CliClient/.gitignore index 95f561808..26260fc3b 100644 --- a/CliClient/.gitignore +++ b/CliClient/.gitignore @@ -12,4 +12,6 @@ tests/fuzzing/sync tests/fuzzing.* tests/fuzzing -* tests/logs/* -tests/cli-integration/ \ No newline at end of file +tests/cli-integration/ +*.mo +*.*~ \ No newline at end of file diff --git a/CliClient/app/app.js b/CliClient/app/app.js index 8fd9d36eb..3ec69db2a 100644 --- a/CliClient/app/app.js +++ b/CliClient/app/app.js @@ -17,7 +17,7 @@ import { sprintf } from 'sprintf-js'; import { vorpalUtils } from 'vorpal-utils.js'; import { reg } from 'lib/registry.js'; import { fileExtension } from 'lib/path-utils.js'; -import { _ } from 'lib/locale.js'; +import { _, setLocale } from 'lib/locale.js'; import os from 'os'; import fs from 'fs-extra'; @@ -222,6 +222,8 @@ class Application { if (cmd.autocomplete()) vorpalCmd.autocomplete(cmd.autocomplete()); let actionFn = async function(args, end) { + setLocale(Setting.value('locale')); + try { const fn = cmd.action.bind(this); await fn(args); @@ -332,6 +334,8 @@ class Application { BaseModel.db_ = this.database_; await Setting.load(); + setLocale(Setting.value('locale')); + let currentFolderId = Setting.value('activeFolderId'); this.currentFolder_ = null; if (currentFolderId) this.currentFolder_ = await Folder.load(currentFolderId); diff --git a/CliClient/app/build-translation.js b/CliClient/app/build-translation.js index ee471c100..96288bbc1 100644 --- a/CliClient/app/build-translation.js +++ b/CliClient/app/build-translation.js @@ -3,13 +3,38 @@ require('source-map-support').install(); require('babel-plugin-transform-runtime'); +const processArgs = process.argv.splice(2, process.argv.length); + +const silentLog = processArgs.indexOf('--silent') >= 0; + +import { basename, dirname } from 'lib/path-utils.js'; import fs from 'fs-extra'; import gettextParser from 'gettext-parser'; -const localeDir = __dirname + '/../app/locale'; -const outputDir = __dirname + '/locale'; +const rootDir = dirname(dirname(__dirname)); +const cliDir = rootDir + '/CliClient'; +const cliLocalesDir = cliDir + '/locales'; +const rnDir = rootDir + '/ReactNativeClient'; -fs.mkdirpSync(outputDir, 0o755); +function execCommand(command) { + if (!silentLog) console.info('Running: ' + command); + + const exec = require('child_process').exec + + return new Promise((resolve, reject) => { + let childProcess = exec(command, (error, stdout, stderr) => { + if (error) { + if (error.signal == 'SIGTERM') { + resolve('Process was killed'); + } else { + reject(error); + } + } else { + resolve(stdout.trim()); + } + }); + }); +} function parsePoFile(filePath) { const content = fs.readFileSync(filePath); @@ -31,14 +56,64 @@ function saveToFile(filePath, data) { fs.writeFileSync(filePath, data); } -const inputFile = localeDir + '/fr_FR.po'; -const outputFile = outputDir + '/fr_FR.json'; - function buildLocale(inputFile, outputFile) { const r = parsePoFile(inputFile); const translation = serializeTranslation(r); saveToFile(outputFile, translation); } -buildLocale(localeDir + '/fr_FR.po', outputDir + '/fr_FR.json'); -buildLocale(localeDir + '/en_GB.po', outputDir + '/en_GB.json'); \ No newline at end of file +async function createPotFile(potFilePath, sources) { + let baseArgs = []; + baseArgs.push('--from-code=utf-8'); + baseArgs.push('--output="' + potFilePath + '"'); + baseArgs.push('--language=JavaScript'); + baseArgs.push('--copyright-holder="Laurent Cozic"'); + baseArgs.push('--package-name=Joplin-CLI'); + baseArgs.push('--package-version=1.0.0'); + + for (let i = 0; i < sources.length; i++) { + let args = baseArgs.slice(); + if (i > 0) args.push('--join-existing'); + args.push(sources[i]); + const result = await execCommand('xgettext ' + args.join(' ')); + if (result) console.error(result); + } +} + +async function mergePotToPo(potFilePath, poFilePath) { + const command = 'msgmerge -U "' + poFilePath + '" "' + potFilePath + '"'; + const result = await execCommand(command); + if (result) console.error(result); +} + +async function main() { + let potFilePath = cliLocalesDir + '/joplin.pot'; + let jsonLocalesDir = cliDir + '/build/locales'; + const defaultLocale = 'en_GB'; + + await createPotFile(potFilePath, [ + cliDir + '/app/*.js', + rnDir + '/lib/*.js', + rnDir + '/lib/models/*.js', + rnDir + '/lib/services/*.js', + ]); + + await execCommand('cp "' + potFilePath + '" ' + '"' + cliLocalesDir + '/' + defaultLocale + '.po"'); + + fs.mkdirpSync(jsonLocalesDir, 0o755); + + let locales = [defaultLocale, 'fr_FR']; + for (let i = 0; i < locales.length; i++) { + const locale = locales[i]; + const poFilePäth = cliLocalesDir + '/' + locale + '.po'; + const jsonFilePath = jsonLocalesDir + '/' + locale + '.json'; + if (locale != defaultLocale) await mergePotToPo(potFilePath, poFilePäth); + buildLocale(poFilePäth, jsonFilePath); + } + + saveToFile(jsonLocalesDir + '/index.json', JSON.stringify(locales)); +} + +main().catch((error) => { + console.error(error); +}); \ No newline at end of file diff --git a/CliClient/app/locale/en_GB.po b/CliClient/app/locale/en_GB.po deleted file mode 100644 index 0026831b7..000000000 --- a/CliClient/app/locale/en_GB.po +++ /dev/null @@ -1,237 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Laurent Cozic -# This file is distributed under the same license as the Joplin-CLI package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: Joplin-CLI 1.0.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-07-17 17:25+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: app/app.js:92 -msgid "No notebook selected." -msgstr "" - -#: app/app.js:97 -msgid "No notebook has been specified." -msgstr "" - -#: app/app.js:128 -msgid "Usage: --profile " -msgstr "" - -#: app/app.js:135 -msgid "Usage: --env " -msgstr "" - -#: app/app.js:160 -msgid "Usage: --log-level " -msgstr "" - -#: app/app.js:167 -#, javascript-format -msgid "Unknown flag: %s" -msgstr "" - -#: app/app.js:183 -#, javascript-format -msgid "" -"Command line argument \"%s\" contains both quotes and double-quotes - " -"aborting." -msgstr "" - -#: app/app.js:275 -#, javascript-format -msgid "Synchronizing with directory \"%s\"" -msgstr "" - -#: app/app.js:352 -msgid "No notebook is defined. Create one with `mkbook `." -msgstr "" - -#: app/command-cat.js:33 -#, javascript-format -msgid "No item \"%s\" found." -msgstr "" - -#: app/command-cp.js:31 app/command-mv.js:36 -#, javascript-format -msgid "No notebook \"%s\"" -msgstr "" - -#: app/command-cp.js:34 app/command-mv.js:39 -#, javascript-format -msgid "No note matches this pattern: \"%s\"" -msgstr "" - -#: app/command-edit.js:33 -msgid "Done editing." -msgstr "" - -#: app/command-edit.js:39 -msgid "" -"No text editor is defined. Please set it using `config editor `" -msgstr "" - -#: app/command-edit.js:45 -msgid "No active notebook." -msgstr "" - -#: app/command-edit.js:66 -msgid "Starting to edit note. Close the editor to get back to the prompt." -msgstr "" - -#: app/command-import-enex.js:16 -msgid "Imports an Evernote notebook file (.enex file)." -msgstr "" - -#: app/command-import-enex.js:35 -#, javascript-format -msgid "Folder does not exists: \"%s\". Create it?" -msgstr "" - -#: app/command-import-enex.js:42 -#, javascript-format -msgid "Imported - %s" -msgstr "" - -#: app/command-import-enex.js:55 -#, javascript-format -msgid "File \"%s\" will be imported into notebook \"%s\". Continue?" -msgstr "" - -#: app/command-import-enex.js:62 -#, javascript-format -msgid "Found: %d." -msgstr "" - -#: app/command-import-enex.js:63 -#, javascript-format -msgid "Created: %d." -msgstr "" - -#: app/command-import-enex.js:64 -#, javascript-format -msgid "Updated: %d." -msgstr "" - -#: app/command-import-enex.js:65 -#, javascript-format -msgid "Skipped: %d." -msgstr "" - -#: app/command-import-enex.js:66 -#, javascript-format -msgid "Resources: %d." -msgstr "" - -#: app/command-import-enex.js:67 -#, javascript-format -msgid "Tagged: %d." -msgstr "" - -#: app/command-import-enex.js:78 -msgid "Importing notes..." -msgstr "" - -#: app/command-ls.js:65 -msgid "Please select a notebook first." -msgstr "" - -#: app/command-mknote.js:17 -msgid "Notes can only be created within a notebook." -msgstr "" - -#: app/command-mv.js:29 -#, javascript-format -msgid "No item matches pattern \"%s\"" -msgstr "" - -#: app/command-rm.js:39 -#, javascript-format -msgid "No notebook matchin pattern \"%s\"" -msgstr "" - -#: app/command-rm.js:40 -#, javascript-format -msgid "Delete notebook \"%s\"?" -msgstr "" - -#: app/command-rm.js:46 -#, javascript-format -msgid "No note matchin pattern \"%s\"" -msgstr "" - -#: app/command-rm.js:47 -#, javascript-format -msgid "%d notes match this pattern. Delete them?" -msgstr "" - -#: app/command-search.js:29 -#, javascript-format -msgid "Notebook not found: \"%s\"" -msgstr "" - -#: app/command-set.js:31 -#, javascript-format -msgid "No note \"%s\" found." -msgstr "" - -#: app/command-sync.js:65 -msgid "Synchronisation is already in progress." -msgstr "" - -#: app/command-sync.js:87 -#, javascript-format -msgid "Synchronization target: %s" -msgstr "" - -#: app/command-sync.js:89 -msgid "Cannot initialize synchronizer." -msgstr "" - -#: app/command-sync.js:91 -msgid "Starting synchronization..." -msgstr "" - -#: app/command-sync.js:98 -msgid "Done." -msgstr "" - -#: app/command-sync.js:113 -msgid "Cancelling..." -msgstr "" - -#: app/command-tag.js:25 app/command-tag.js:34 -#, javascript-format -msgid "Tag does not exist: \"%s\"" -msgstr "" - -#: app/command-tag.js:28 app/command-tag.js:35 -#, javascript-format -msgid "Note does not exist: \"%s\"" -msgstr "" - -#: app/command-tag.js:48 -#, javascript-format -msgid "Invalid command: \"%s\"" -msgstr "" - -#: app/command-use.js:28 -#, javascript-format -msgid "No folder \"%s\"" -msgstr "" - -#: app/command-version.js:17 -#, javascript-format -msgid "%s %s (%s)" -msgstr "" diff --git a/CliClient/app/locale/fr_FR.mo b/CliClient/app/locale/fr_FR.mo deleted file mode 100644 index b67a1434a..000000000 Binary files a/CliClient/app/locale/fr_FR.mo and /dev/null differ diff --git a/CliClient/app/locale/fr_FR.po b/CliClient/app/locale/fr_FR.po deleted file mode 100644 index ca806a8c8..000000000 --- a/CliClient/app/locale/fr_FR.po +++ /dev/null @@ -1,238 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Laurent Cozic -# This file is distributed under the same license as the Joplin-CLI package. -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: Joplin-CLI 1.0.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-07-17 17:01+0100\n" -"PO-Revision-Date: 2017-07-17 17:02+0100\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.7.1\n" -"Last-Translator: \n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" -"Language: fr_FR\n" - -#: app/app.js:92 -msgid "No notebook selected." -msgstr "Aucun carnet n'est sélectionné." - -#: app/app.js:97 -msgid "No notebook has been specified." -msgstr "" - -#: app/app.js:128 -msgid "Usage: --profile " -msgstr "" - -#: app/app.js:135 -msgid "Usage: --env " -msgstr "" - -#: app/app.js:160 -msgid "Usage: --log-level " -msgstr "" - -#: app/app.js:167 -#, javascript-format -msgid "Unknown flag: %s" -msgstr "" - -#: app/app.js:183 -#, javascript-format -msgid "" -"Command line argument \"%s\" contains both quotes and double-quotes - " -"aborting." -msgstr "" - -#: app/app.js:275 -#, javascript-format -msgid "Synchronizing with directory \"%s\"" -msgstr "" - -#: app/app.js:352 -msgid "No notebook is defined. Create one with `mkbook `." -msgstr "" - -#: app/command-cat.js:33 -#, javascript-format -msgid "No item \"%s\" found." -msgstr "" - -#: app/command-cp.js:31 app/command-mv.js:36 -#, javascript-format -msgid "No notebook \"%s\"" -msgstr "" - -#: app/command-cp.js:34 app/command-mv.js:39 -#, javascript-format -msgid "No note matches this pattern: \"%s\"" -msgstr "" - -#: app/command-edit.js:33 -msgid "Done editing." -msgstr "" - -#: app/command-edit.js:39 -msgid "" -"No text editor is defined. Please set it using `config editor `" -msgstr "" - -#: app/command-edit.js:45 -msgid "No active notebook." -msgstr "" - -#: app/command-edit.js:66 -msgid "Starting to edit note. Close the editor to get back to the prompt." -msgstr "" - -#: app/command-import-enex.js:16 -msgid "Imports an Evernote notebook file (.enex file)." -msgstr "" - -#: app/command-import-enex.js:35 -#, javascript-format -msgid "Folder does not exists: \"%s\". Create it?" -msgstr "" - -#: app/command-import-enex.js:42 -#, javascript-format -msgid "Imported - %s" -msgstr "" - -#: app/command-import-enex.js:55 -#, javascript-format -msgid "File \"%s\" will be imported into notebook \"%s\". Continue?" -msgstr "" - -#: app/command-import-enex.js:62 -#, javascript-format -msgid "Found: %d." -msgstr "" - -#: app/command-import-enex.js:63 -#, javascript-format -msgid "Created: %d." -msgstr "" - -#: app/command-import-enex.js:64 -#, javascript-format -msgid "Updated: %d." -msgstr "" - -#: app/command-import-enex.js:65 -#, javascript-format -msgid "Skipped: %d." -msgstr "" - -#: app/command-import-enex.js:66 -#, javascript-format -msgid "Resources: %d." -msgstr "" - -#: app/command-import-enex.js:67 -#, javascript-format -msgid "Tagged: %d." -msgstr "" - -#: app/command-import-enex.js:78 -msgid "Importing notes..." -msgstr "" - -#: app/command-ls.js:65 -msgid "Please select a notebook first." -msgstr "" - -#: app/command-mknote.js:17 -msgid "Notes can only be created within a notebook." -msgstr "" - -#: app/command-mv.js:29 -#, javascript-format -msgid "No item matches pattern \"%s\"" -msgstr "" - -#: app/command-rm.js:39 -#, javascript-format -msgid "No notebook matchin pattern \"%s\"" -msgstr "" - -#: app/command-rm.js:40 -#, javascript-format -msgid "Delete notebook \"%s\"?" -msgstr "" - -#: app/command-rm.js:46 -#, javascript-format -msgid "No note matchin pattern \"%s\"" -msgstr "" - -#: app/command-rm.js:47 -#, javascript-format -msgid "%d notes match this pattern. Delete them?" -msgstr "" - -#: app/command-search.js:29 -#, javascript-format -msgid "Notebook not found: \"%s\"" -msgstr "" - -#: app/command-set.js:31 -#, javascript-format -msgid "No note \"%s\" found." -msgstr "" - -#: app/command-sync.js:65 -msgid "Synchronisation is already in progress." -msgstr "" - -#: app/command-sync.js:87 -#, javascript-format -msgid "Synchronization target: %s" -msgstr "" - -#: app/command-sync.js:89 -msgid "Cannot initialize synchronizer." -msgstr "" - -#: app/command-sync.js:91 -msgid "Starting synchronization..." -msgstr "" - -#: app/command-sync.js:98 -msgid "Done." -msgstr "" - -#: app/command-sync.js:113 -msgid "Cancelling..." -msgstr "" - -#: app/command-tag.js:25 app/command-tag.js:34 -#, javascript-format -msgid "Tag does not exist: \"%s\"" -msgstr "" - -#: app/command-tag.js:28 app/command-tag.js:35 -#, javascript-format -msgid "Note does not exist: \"%s\"" -msgstr "" - -#: app/command-tag.js:48 -#, javascript-format -msgid "Invalid command: \"%s\"" -msgstr "" - -#: app/command-use.js:28 -#, javascript-format -msgid "No folder \"%s\"" -msgstr "" - -#: app/command-version.js:17 -#, javascript-format -msgid "%s %s (%s)" -msgstr "" diff --git a/CliClient/build-translation.js b/CliClient/build-translation.js deleted file mode 100644 index 70b613b93..000000000 --- a/CliClient/build-translation.js +++ /dev/null @@ -1,6 +0,0 @@ -var localeDir = __dirname + '/app/locale'; - - -var input = require('fs').readFileSync('en.po'); -var po = gettextParser.po.parse(input); -// console.log(po.translations['']); \ No newline at end of file diff --git a/CliClient/build.sh b/CliClient/build.sh index 8eba8ec2f..4c5cd8a62 100755 --- a/CliClient/build.sh +++ b/CliClient/build.sh @@ -1,13 +1,13 @@ #!/bin/bash +set -e + CLIENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -yarn install mkdir -p "$CLIENT_DIR/build" rm -f "$CLIENT_DIR/app/lib" ln -s "$CLIENT_DIR/../ReactNativeClient/lib" "$CLIENT_DIR/app" cp "$CLIENT_DIR/package.json" "$CLIENT_DIR/build" -# Always keep this as the last line so that the exit -# code of build.sh is the same as the build command: -#npm run build -yarn run build \ No newline at end of file +yarn run build + +NODE_PATH="$CLIENT_DIR/build" node "$CLIENT_DIR/build/build-translation.js" --silent \ No newline at end of file diff --git a/CliClient/locales/en_GB.po b/CliClient/locales/en_GB.po new file mode 100644 index 000000000..a960df94e --- /dev/null +++ b/CliClient/locales/en_GB.po @@ -0,0 +1,349 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Laurent Cozic +# This file is distributed under the same license as the Joplin-CLI package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Joplin-CLI 1.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-18 11:57+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:92 +msgid "No notebook selected." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:97 +msgid "No notebook has been specified." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:128 +msgid "Usage: --profile " +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:135 +msgid "Usage: --env " +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:160 +msgid "Usage: --log-level " +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:167 +#, javascript-format +msgid "Unknown flag: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:183 +#, javascript-format +msgid "" +"Command line argument \"%s\" contains both quotes and double-quotes - " +"aborting." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:277 +#, javascript-format +msgid "Synchronizing with directory \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:356 +msgid "No notebook is defined. Create one with `mkbook `." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-cat.js:33 +#, javascript-format +msgid "No item \"%s\" found." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-cp.js:31 +#: /media/veracrypt22/src/notes/CliClient/app/command-mv.js:36 +#, javascript-format +msgid "No notebook \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-cp.js:34 +#: /media/veracrypt22/src/notes/CliClient/app/command-mv.js:39 +#, javascript-format +msgid "No note matches this pattern: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:33 +msgid "Done editing." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:39 +msgid "" +"No text editor is defined. Please set it using `config editor `" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:45 +msgid "No active notebook." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:66 +msgid "Starting to edit note. Close the editor to get back to the prompt." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:16 +msgid "Imports an Evernote notebook file (.enex file)." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:35 +#, javascript-format +msgid "Folder does not exists: \"%s\". Create it?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:42 +#, javascript-format +msgid "Imported - %s" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:55 +#, javascript-format +msgid "File \"%s\" will be imported into notebook \"%s\". Continue?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:62 +#, javascript-format +msgid "Found: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:63 +#, javascript-format +msgid "Created: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:64 +#, javascript-format +msgid "Updated: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:65 +#, javascript-format +msgid "Skipped: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:66 +#, javascript-format +msgid "Resources: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:67 +#, javascript-format +msgid "Tagged: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:78 +msgid "Importing notes..." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-ls.js:65 +msgid "Please select a notebook first." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-mknote.js:17 +msgid "Notes can only be created within a notebook." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-mv.js:29 +#, javascript-format +msgid "No item matches pattern \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:39 +#, javascript-format +msgid "No notebook matchin pattern \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:40 +#, javascript-format +msgid "Delete notebook \"%s\"?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:46 +#, javascript-format +msgid "No note matchin pattern \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:47 +#, javascript-format +msgid "%d notes match this pattern. Delete them?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-search.js:29 +#, javascript-format +msgid "Notebook not found: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-set.js:31 +#, javascript-format +msgid "No note \"%s\" found." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:66 +msgid "Synchronisation is already in progress." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:88 +#, javascript-format +msgid "Synchronization target: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:90 +msgid "Cannot initialize synchronizer." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:92 +msgid "Starting synchronization..." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:99 +msgid "Done." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:114 +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:60 +msgid "Cancelling..." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:25 +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:34 +#, javascript-format +msgid "Tag does not exist: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:28 +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:35 +#, javascript-format +msgid "Note does not exist: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:48 +#, javascript-format +msgid "Invalid command: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-use.js:28 +#, javascript-format +msgid "No folder \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-version.js:17 +#, javascript-format +msgid "%s %s (%s)" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/logger.js:147 +#, javascript-format +msgid "Unknown log level: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:52 +#, javascript-format +msgid "Created local items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:53 +#, javascript-format +msgid "Updated local items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:54 +#, javascript-format +msgid "Created remote items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:55 +#, javascript-format +msgid "Updated remote items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:56 +#, javascript-format +msgid "Deleted local items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:57 +#, javascript-format +msgid "Deleted remote items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:58 +#, javascript-format +msgid "State: %s." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:59 +#, javascript-format +msgid "Last error: %s (stacktrace in log)." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:61 +#, javascript-format +msgid "Completed: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/folder.js:81 +msgid "Conflicts" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/folder.js:136 +#, javascript-format +msgid "A notebook with this title already exists: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/folder.js:140 +#, javascript-format +msgid "Notebooks cannot be named \"%s\", which is a reserved title." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/note.js:194 +#, javascript-format +msgid "Cannot copy note to \"%s\" notebook" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/note.js:205 +#, javascript-format +msgid "Cannot move note to \"%s\" notebook" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:54 +msgid "Sync status (synced items / total items)" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:59 +#, javascript-format +msgid "%s: %d/%d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:62 +#, javascript-format +msgid "Total: %d/%d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:64 +#, javascript-format +msgid "Conflicted: %d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:65 +#, javascript-format +msgid "To delete: %d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:70 +msgid "Folders" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:80 +#, javascript-format +msgid "%s: %d notes" +msgstr "" diff --git a/CliClient/locales/fr_FR.po b/CliClient/locales/fr_FR.po new file mode 100644 index 000000000..4b3b3e522 --- /dev/null +++ b/CliClient/locales/fr_FR.po @@ -0,0 +1,349 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Laurent Cozic +# This file is distributed under the same license as the Joplin-CLI package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Joplin-CLI 1.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-18 11:56+0100\n" +"PO-Revision-Date: 2017-07-18 11:18+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: fr_FR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.7.1\n" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:92 +msgid "No notebook selected." +msgstr "Aucun carnet n'est sélectionné." + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:97 +msgid "No notebook has been specified." +msgstr "Aucun carnet n'est spécifié." + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:128 +msgid "Usage: --profile " +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:135 +msgid "Usage: --env " +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:160 +msgid "Usage: --log-level " +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:167 +#, javascript-format +msgid "Unknown flag: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:183 +#, javascript-format +msgid "" +"Command line argument \"%s\" contains both quotes and double-quotes - " +"aborting." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:277 +#, javascript-format +msgid "Synchronizing with directory \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:356 +msgid "No notebook is defined. Create one with `mkbook `." +msgstr "Aucun carnet n'est défini. Créez-en un avec `mkbook `." + +#: /media/veracrypt22/src/notes/CliClient/app/command-cat.js:33 +#, javascript-format +msgid "No item \"%s\" found." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-cp.js:31 +#: /media/veracrypt22/src/notes/CliClient/app/command-mv.js:36 +#, javascript-format +msgid "No notebook \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-cp.js:34 +#: /media/veracrypt22/src/notes/CliClient/app/command-mv.js:39 +#, javascript-format +msgid "No note matches this pattern: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:33 +msgid "Done editing." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:39 +msgid "" +"No text editor is defined. Please set it using `config editor `" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:45 +msgid "No active notebook." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:66 +msgid "Starting to edit note. Close the editor to get back to the prompt." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:16 +msgid "Imports an Evernote notebook file (.enex file)." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:35 +#, javascript-format +msgid "Folder does not exists: \"%s\". Create it?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:42 +#, javascript-format +msgid "Imported - %s" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:55 +#, javascript-format +msgid "File \"%s\" will be imported into notebook \"%s\". Continue?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:62 +#, javascript-format +msgid "Found: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:63 +#, javascript-format +msgid "Created: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:64 +#, javascript-format +msgid "Updated: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:65 +#, javascript-format +msgid "Skipped: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:66 +#, javascript-format +msgid "Resources: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:67 +#, javascript-format +msgid "Tagged: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:78 +msgid "Importing notes..." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-ls.js:65 +msgid "Please select a notebook first." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-mknote.js:17 +msgid "Notes can only be created within a notebook." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-mv.js:29 +#, javascript-format +msgid "No item matches pattern \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:39 +#, javascript-format +msgid "No notebook matchin pattern \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:40 +#, javascript-format +msgid "Delete notebook \"%s\"?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:46 +#, javascript-format +msgid "No note matchin pattern \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:47 +#, javascript-format +msgid "%d notes match this pattern. Delete them?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-search.js:29 +#, javascript-format +msgid "Notebook not found: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-set.js:31 +#, javascript-format +msgid "No note \"%s\" found." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:66 +msgid "Synchronisation is already in progress." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:88 +#, javascript-format +msgid "Synchronization target: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:90 +msgid "Cannot initialize synchronizer." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:92 +msgid "Starting synchronization..." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:99 +msgid "Done." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:114 +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:60 +msgid "Cancelling..." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:25 +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:34 +#, javascript-format +msgid "Tag does not exist: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:28 +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:35 +#, javascript-format +msgid "Note does not exist: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:48 +#, javascript-format +msgid "Invalid command: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-use.js:28 +#, javascript-format +msgid "No folder \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-version.js:17 +#, javascript-format +msgid "%s %s (%s)" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/logger.js:147 +#, javascript-format +msgid "Unknown log level: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:52 +#, javascript-format +msgid "Created local items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:53 +#, javascript-format +msgid "Updated local items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:54 +#, javascript-format +msgid "Created remote items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:55 +#, javascript-format +msgid "Updated remote items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:56 +#, javascript-format +msgid "Deleted local items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:57 +#, javascript-format +msgid "Deleted remote items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:58 +#, javascript-format +msgid "State: %s." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:59 +#, javascript-format +msgid "Last error: %s (stacktrace in log)." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:61 +#, javascript-format +msgid "Completed: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/folder.js:81 +msgid "Conflicts" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/folder.js:136 +#, javascript-format +msgid "A notebook with this title already exists: \"%s\"" +msgstr "Un carnet avec ce titre existe déjà : \"%s\"" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/folder.js:140 +#, javascript-format +msgid "Notebooks cannot be named \"%s\", which is a reserved title." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/note.js:194 +#, javascript-format +msgid "Cannot copy note to \"%s\" notebook" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/note.js:205 +#, javascript-format +msgid "Cannot move note to \"%s\" notebook" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:54 +msgid "Sync status (synced items / total items)" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:59 +#, javascript-format +msgid "%s: %d/%d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:62 +#, javascript-format +msgid "Total: %d/%d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:64 +#, javascript-format +msgid "Conflicted: %d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:65 +#, javascript-format +msgid "To delete: %d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:70 +msgid "Folders" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:80 +#, javascript-format +msgid "%s: %d notes" +msgstr "" diff --git a/CliClient/locales/joplin.pot b/CliClient/locales/joplin.pot new file mode 100644 index 000000000..a960df94e --- /dev/null +++ b/CliClient/locales/joplin.pot @@ -0,0 +1,349 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Laurent Cozic +# This file is distributed under the same license as the Joplin-CLI package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Joplin-CLI 1.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-18 11:57+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:92 +msgid "No notebook selected." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:97 +msgid "No notebook has been specified." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:128 +msgid "Usage: --profile " +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:135 +msgid "Usage: --env " +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:160 +msgid "Usage: --log-level " +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:167 +#, javascript-format +msgid "Unknown flag: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:183 +#, javascript-format +msgid "" +"Command line argument \"%s\" contains both quotes and double-quotes - " +"aborting." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:277 +#, javascript-format +msgid "Synchronizing with directory \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/app.js:356 +msgid "No notebook is defined. Create one with `mkbook `." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-cat.js:33 +#, javascript-format +msgid "No item \"%s\" found." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-cp.js:31 +#: /media/veracrypt22/src/notes/CliClient/app/command-mv.js:36 +#, javascript-format +msgid "No notebook \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-cp.js:34 +#: /media/veracrypt22/src/notes/CliClient/app/command-mv.js:39 +#, javascript-format +msgid "No note matches this pattern: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:33 +msgid "Done editing." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:39 +msgid "" +"No text editor is defined. Please set it using `config editor `" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:45 +msgid "No active notebook." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-edit.js:66 +msgid "Starting to edit note. Close the editor to get back to the prompt." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:16 +msgid "Imports an Evernote notebook file (.enex file)." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:35 +#, javascript-format +msgid "Folder does not exists: \"%s\". Create it?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:42 +#, javascript-format +msgid "Imported - %s" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:55 +#, javascript-format +msgid "File \"%s\" will be imported into notebook \"%s\". Continue?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:62 +#, javascript-format +msgid "Found: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:63 +#, javascript-format +msgid "Created: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:64 +#, javascript-format +msgid "Updated: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:65 +#, javascript-format +msgid "Skipped: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:66 +#, javascript-format +msgid "Resources: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:67 +#, javascript-format +msgid "Tagged: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-import-enex.js:78 +msgid "Importing notes..." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-ls.js:65 +msgid "Please select a notebook first." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-mknote.js:17 +msgid "Notes can only be created within a notebook." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-mv.js:29 +#, javascript-format +msgid "No item matches pattern \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:39 +#, javascript-format +msgid "No notebook matchin pattern \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:40 +#, javascript-format +msgid "Delete notebook \"%s\"?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:46 +#, javascript-format +msgid "No note matchin pattern \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-rm.js:47 +#, javascript-format +msgid "%d notes match this pattern. Delete them?" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-search.js:29 +#, javascript-format +msgid "Notebook not found: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-set.js:31 +#, javascript-format +msgid "No note \"%s\" found." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:66 +msgid "Synchronisation is already in progress." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:88 +#, javascript-format +msgid "Synchronization target: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:90 +msgid "Cannot initialize synchronizer." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:92 +msgid "Starting synchronization..." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:99 +msgid "Done." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-sync.js:114 +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:60 +msgid "Cancelling..." +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:25 +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:34 +#, javascript-format +msgid "Tag does not exist: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:28 +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:35 +#, javascript-format +msgid "Note does not exist: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-tag.js:48 +#, javascript-format +msgid "Invalid command: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-use.js:28 +#, javascript-format +msgid "No folder \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/CliClient/app/command-version.js:17 +#, javascript-format +msgid "%s %s (%s)" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/logger.js:147 +#, javascript-format +msgid "Unknown log level: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:52 +#, javascript-format +msgid "Created local items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:53 +#, javascript-format +msgid "Updated local items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:54 +#, javascript-format +msgid "Created remote items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:55 +#, javascript-format +msgid "Updated remote items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:56 +#, javascript-format +msgid "Deleted local items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:57 +#, javascript-format +msgid "Deleted remote items: %d." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:58 +#, javascript-format +msgid "State: %s." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:59 +#, javascript-format +msgid "Last error: %s (stacktrace in log)." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/synchronizer.js:61 +#, javascript-format +msgid "Completed: %s" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/folder.js:81 +msgid "Conflicts" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/folder.js:136 +#, javascript-format +msgid "A notebook with this title already exists: \"%s\"" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/folder.js:140 +#, javascript-format +msgid "Notebooks cannot be named \"%s\", which is a reserved title." +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/note.js:194 +#, javascript-format +msgid "Cannot copy note to \"%s\" notebook" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/models/note.js:205 +#, javascript-format +msgid "Cannot move note to \"%s\" notebook" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:54 +msgid "Sync status (synced items / total items)" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:59 +#, javascript-format +msgid "%s: %d/%d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:62 +#, javascript-format +msgid "Total: %d/%d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:64 +#, javascript-format +msgid "Conflicted: %d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:65 +#, javascript-format +msgid "To delete: %d" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:70 +msgid "Folders" +msgstr "" + +#: /media/veracrypt22/src/notes/ReactNativeClient/lib/services/report.js:80 +#, javascript-format +msgid "%s: %d notes" +msgstr "" diff --git a/CliClient/makepot.sh b/CliClient/makepot.sh deleted file mode 100755 index 6d5f417bc..000000000 --- a/CliClient/makepot.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -e - -xgettext --output=translation.pot --language=JavaScript --copyright-holder="Laurent Cozic" --package-name=Joplin-CLI --package-version=1.0.0 app/*.js -cp translation.pot app/locale/en_GB.po \ No newline at end of file diff --git a/CliClient/translation.pot b/CliClient/translation.pot deleted file mode 100644 index 0026831b7..000000000 --- a/CliClient/translation.pot +++ /dev/null @@ -1,237 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Laurent Cozic -# This file is distributed under the same license as the Joplin-CLI package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: Joplin-CLI 1.0.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-07-17 17:25+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: app/app.js:92 -msgid "No notebook selected." -msgstr "" - -#: app/app.js:97 -msgid "No notebook has been specified." -msgstr "" - -#: app/app.js:128 -msgid "Usage: --profile " -msgstr "" - -#: app/app.js:135 -msgid "Usage: --env " -msgstr "" - -#: app/app.js:160 -msgid "Usage: --log-level " -msgstr "" - -#: app/app.js:167 -#, javascript-format -msgid "Unknown flag: %s" -msgstr "" - -#: app/app.js:183 -#, javascript-format -msgid "" -"Command line argument \"%s\" contains both quotes and double-quotes - " -"aborting." -msgstr "" - -#: app/app.js:275 -#, javascript-format -msgid "Synchronizing with directory \"%s\"" -msgstr "" - -#: app/app.js:352 -msgid "No notebook is defined. Create one with `mkbook `." -msgstr "" - -#: app/command-cat.js:33 -#, javascript-format -msgid "No item \"%s\" found." -msgstr "" - -#: app/command-cp.js:31 app/command-mv.js:36 -#, javascript-format -msgid "No notebook \"%s\"" -msgstr "" - -#: app/command-cp.js:34 app/command-mv.js:39 -#, javascript-format -msgid "No note matches this pattern: \"%s\"" -msgstr "" - -#: app/command-edit.js:33 -msgid "Done editing." -msgstr "" - -#: app/command-edit.js:39 -msgid "" -"No text editor is defined. Please set it using `config editor `" -msgstr "" - -#: app/command-edit.js:45 -msgid "No active notebook." -msgstr "" - -#: app/command-edit.js:66 -msgid "Starting to edit note. Close the editor to get back to the prompt." -msgstr "" - -#: app/command-import-enex.js:16 -msgid "Imports an Evernote notebook file (.enex file)." -msgstr "" - -#: app/command-import-enex.js:35 -#, javascript-format -msgid "Folder does not exists: \"%s\". Create it?" -msgstr "" - -#: app/command-import-enex.js:42 -#, javascript-format -msgid "Imported - %s" -msgstr "" - -#: app/command-import-enex.js:55 -#, javascript-format -msgid "File \"%s\" will be imported into notebook \"%s\". Continue?" -msgstr "" - -#: app/command-import-enex.js:62 -#, javascript-format -msgid "Found: %d." -msgstr "" - -#: app/command-import-enex.js:63 -#, javascript-format -msgid "Created: %d." -msgstr "" - -#: app/command-import-enex.js:64 -#, javascript-format -msgid "Updated: %d." -msgstr "" - -#: app/command-import-enex.js:65 -#, javascript-format -msgid "Skipped: %d." -msgstr "" - -#: app/command-import-enex.js:66 -#, javascript-format -msgid "Resources: %d." -msgstr "" - -#: app/command-import-enex.js:67 -#, javascript-format -msgid "Tagged: %d." -msgstr "" - -#: app/command-import-enex.js:78 -msgid "Importing notes..." -msgstr "" - -#: app/command-ls.js:65 -msgid "Please select a notebook first." -msgstr "" - -#: app/command-mknote.js:17 -msgid "Notes can only be created within a notebook." -msgstr "" - -#: app/command-mv.js:29 -#, javascript-format -msgid "No item matches pattern \"%s\"" -msgstr "" - -#: app/command-rm.js:39 -#, javascript-format -msgid "No notebook matchin pattern \"%s\"" -msgstr "" - -#: app/command-rm.js:40 -#, javascript-format -msgid "Delete notebook \"%s\"?" -msgstr "" - -#: app/command-rm.js:46 -#, javascript-format -msgid "No note matchin pattern \"%s\"" -msgstr "" - -#: app/command-rm.js:47 -#, javascript-format -msgid "%d notes match this pattern. Delete them?" -msgstr "" - -#: app/command-search.js:29 -#, javascript-format -msgid "Notebook not found: \"%s\"" -msgstr "" - -#: app/command-set.js:31 -#, javascript-format -msgid "No note \"%s\" found." -msgstr "" - -#: app/command-sync.js:65 -msgid "Synchronisation is already in progress." -msgstr "" - -#: app/command-sync.js:87 -#, javascript-format -msgid "Synchronization target: %s" -msgstr "" - -#: app/command-sync.js:89 -msgid "Cannot initialize synchronizer." -msgstr "" - -#: app/command-sync.js:91 -msgid "Starting synchronization..." -msgstr "" - -#: app/command-sync.js:98 -msgid "Done." -msgstr "" - -#: app/command-sync.js:113 -msgid "Cancelling..." -msgstr "" - -#: app/command-tag.js:25 app/command-tag.js:34 -#, javascript-format -msgid "Tag does not exist: \"%s\"" -msgstr "" - -#: app/command-tag.js:28 app/command-tag.js:35 -#, javascript-format -msgid "Note does not exist: \"%s\"" -msgstr "" - -#: app/command-tag.js:48 -#, javascript-format -msgid "Invalid command: \"%s\"" -msgstr "" - -#: app/command-use.js:28 -#, javascript-format -msgid "No folder \"%s\"" -msgstr "" - -#: app/command-version.js:17 -#, javascript-format -msgid "%s %s (%s)" -msgstr "" diff --git a/ReactNativeClient/lib/locale.js b/ReactNativeClient/lib/locale.js index d6fc64287..0d6f91bf3 100644 --- a/ReactNativeClient/lib/locale.js +++ b/ReactNativeClient/lib/locale.js @@ -1,13 +1,279 @@ import { sprintf } from 'sprintf-js'; -// This function does nothing for now, but later will return -// a different string depending on the language. -function _(s, ...args) { - return sprintf(s, ...args); +let codeToLanguageE_ = {}; +codeToLanguageE_["aa"] = "Afar"; +codeToLanguageE_["ab"] = "Abkhazian"; +codeToLanguageE_["af"] = "Afrikaans"; +codeToLanguageE_["am"] = "Amharic"; +codeToLanguageE_["an"] = "Aragonese"; +codeToLanguageE_["ar"] = "Arabic"; +codeToLanguageE_["as"] = "Assamese"; +codeToLanguageE_["ay"] = "Aymara"; +codeToLanguageE_["az"] = "Azerbaijani"; +codeToLanguageE_["ba"] = "Bashkir"; +codeToLanguageE_["be"] = "Byelorussian"; +codeToLanguageE_["bg"] = "Bulgarian"; +codeToLanguageE_["bh"] = "Bihari"; +codeToLanguageE_["bi"] = "Bislama"; +codeToLanguageE_["bn"] = "Bangla"; +codeToLanguageE_["bo"] = "Tibetan"; +codeToLanguageE_["br"] = "Breton"; +codeToLanguageE_["ca"] = "Catalan"; +codeToLanguageE_["co"] = "Corsican"; +codeToLanguageE_["cs"] = "Czech"; +codeToLanguageE_["cy"] = "Welsh"; +codeToLanguageE_["da"] = "Danish"; +codeToLanguageE_["de"] = "German"; +codeToLanguageE_["dz"] = "Bhutani"; +codeToLanguageE_["el"] = "Greek"; +codeToLanguageE_["en"] = "English"; +codeToLanguageE_["eo"] = "Esperanto"; +codeToLanguageE_["es"] = "Spanish"; +codeToLanguageE_["et"] = "Estonian"; +codeToLanguageE_["eu"] = "Basque"; +codeToLanguageE_["fa"] = "Persian"; +codeToLanguageE_["fi"] = "Finnish"; +codeToLanguageE_["fj"] = "Fiji"; +codeToLanguageE_["fo"] = "Faroese"; +codeToLanguageE_["fr"] = "French"; +codeToLanguageE_["fy"] = "Frisian"; +codeToLanguageE_["ga"] = "Irish"; +codeToLanguageE_["gd"] = "Gaelic"; +codeToLanguageE_["gl"] = "Galician"; +codeToLanguageE_["gn"] = "Guarani"; +codeToLanguageE_["gu"] = "Gujarati"; +codeToLanguageE_["ha"] = "Hausa"; +codeToLanguageE_["he"] = "Hebrew"; +codeToLanguageE_["hi"] = "Hindi"; +codeToLanguageE_["hr"] = "Croatian"; +codeToLanguageE_["hu"] = "Hungarian"; +codeToLanguageE_["hy"] = "Armenian"; +codeToLanguageE_["ia"] = "Interlingua"; +codeToLanguageE_["id"] = "Indonesian"; +codeToLanguageE_["ie"] = "Interlingue"; +codeToLanguageE_["ik"] = "Inupiak"; +codeToLanguageE_["is"] = "Icelandic"; +codeToLanguageE_["it"] = "Italian"; +codeToLanguageE_["iu"] = "Inuktitut"; +codeToLanguageE_["ja"] = "Japanese"; +codeToLanguageE_["jw"] = "Javanese"; +codeToLanguageE_["ka"] = "Georgian"; +codeToLanguageE_["kk"] = "Kazakh"; +codeToLanguageE_["kl"] = "Greenlandic"; +codeToLanguageE_["km"] = "Cambodian"; +codeToLanguageE_["kn"] = "Kannada"; +codeToLanguageE_["ko"] = "Korean"; +codeToLanguageE_["ks"] = "Kashmiri"; +codeToLanguageE_["ku"] = "Kurdish"; +codeToLanguageE_["ky"] = "Kirghiz"; +codeToLanguageE_["la"] = "Latin"; +codeToLanguageE_["ln"] = "Lingala"; +codeToLanguageE_["lo"] = "Laothian"; +codeToLanguageE_["lt"] = "Lithuanian"; +codeToLanguageE_["lv"] = "Lettish"; +codeToLanguageE_["mg"] = "Malagasy"; +codeToLanguageE_["mi"] = "Maori"; +codeToLanguageE_["mk"] = "Macedonian"; +codeToLanguageE_["ml"] = "Malayalam"; +codeToLanguageE_["mn"] = "Mongolian"; +codeToLanguageE_["mo"] = "Moldavian"; +codeToLanguageE_["mr"] = "Marathi"; +codeToLanguageE_["ms"] = "Malay"; +codeToLanguageE_["mt"] = "Maltese"; +codeToLanguageE_["my"] = "Burmese"; +codeToLanguageE_["na"] = "Nauru"; +codeToLanguageE_["ne"] = "Nepali"; +codeToLanguageE_["nl"] = "Dutch"; +codeToLanguageE_["no"] = "Norwegian"; +codeToLanguageE_["oc"] = "Occitan"; +codeToLanguageE_["om"] = "Oromo"; +codeToLanguageE_["or"] = "Oriya"; +codeToLanguageE_["pa"] = "Punjabi"; +codeToLanguageE_["pl"] = "Polish"; +codeToLanguageE_["ps"] = "Pushto"; +codeToLanguageE_["pt"] = "Portuguese"; +codeToLanguageE_["qu"] = "Quechua"; +codeToLanguageE_["rm"] = "Rhaeto-Romance"; +codeToLanguageE_["rn"] = "Kirundi"; +codeToLanguageE_["ro"] = "Romanian"; +codeToLanguageE_["ru"] = "Russian"; +codeToLanguageE_["rw"] = "Kinyarwanda"; +codeToLanguageE_["sa"] = "Sanskrit"; +codeToLanguageE_["sd"] = "Sindhi"; +codeToLanguageE_["sg"] = "Sangho"; +codeToLanguageE_["sh"] = "Serbo-Croatian"; +codeToLanguageE_["si"] = "Sinhalese"; +codeToLanguageE_["sk"] = "Slovak"; +codeToLanguageE_["sl"] = "Slovenian"; +codeToLanguageE_["sm"] = "Samoan"; +codeToLanguageE_["sn"] = "Shona"; +codeToLanguageE_["so"] = "Somali"; +codeToLanguageE_["sq"] = "Albanian"; +codeToLanguageE_["sr"] = "Serbian"; +codeToLanguageE_["ss"] = "Siswati"; +codeToLanguageE_["st"] = "Sesotho"; +codeToLanguageE_["su"] = "Sundanese"; +codeToLanguageE_["sv"] = "Swedish"; +codeToLanguageE_["sw"] = "Swahili"; +codeToLanguageE_["ta"] = "Tamil"; +codeToLanguageE_["te"] = "Telugu"; +codeToLanguageE_["tg"] = "Tajik"; +codeToLanguageE_["th"] = "Thai"; +codeToLanguageE_["ti"] = "Tigrinya"; +codeToLanguageE_["tk"] = "Turkmen"; +codeToLanguageE_["tl"] = "Tagalog"; +codeToLanguageE_["tn"] = "Setswana"; +codeToLanguageE_["to"] = "Tonga"; +codeToLanguageE_["tr"] = "Turkish"; +codeToLanguageE_["ts"] = "Tsonga"; +codeToLanguageE_["tt"] = "Tatar"; +codeToLanguageE_["tw"] = "Twi"; +codeToLanguageE_["ug"] = "Uighur"; +codeToLanguageE_["uk"] = "Ukrainian"; +codeToLanguageE_["ur"] = "Urdu"; +codeToLanguageE_["uz"] = "Uzbek"; +codeToLanguageE_["vi"] = "Vietnamese"; +codeToLanguageE_["vo"] = "Volapuk"; +codeToLanguageE_["wo"] = "Wolof"; +codeToLanguageE_["xh"] = "Xhosa"; +codeToLanguageE_["yi"] = "Yiddish"; +codeToLanguageE_["yo"] = "Yoruba"; +codeToLanguageE_["za"] = "Zhuang"; +codeToLanguageE_["zh"] = "Chinese"; +codeToLanguageE_["zu"] = "Zulu"; + +let codeToLanguage_ = {}; +codeToLanguage_["an"] = "Aragonés"; +codeToLanguage_["da"] = "Dansk"; +codeToLanguage_["de"] = "Deutsch"; +codeToLanguage_["en"] = "English"; +codeToLanguage_["es"] = "Español"; +codeToLanguage_["fr"] = "Français"; +codeToLanguage_["he"] = "עיברית"; +codeToLanguage_["it"] = "Italiano"; +codeToLanguage_["lt"] = "Lietuvių kalba"; +codeToLanguage_["nl"] = "Nederlands"; +codeToLanguage_["pl"] = "Polski"; +codeToLanguage_["pt"] = "Português"; +codeToLanguage_["ru"] = "Русский"; +codeToLanguage_["sk"] = "Slovenčina"; +codeToLanguage_["sq"] = "Shqip"; +codeToLanguage_["sr"] = "српски језик"; +codeToLanguage_["tr"] = "Türkçe"; +codeToLanguage_["ja"] = "日本語"; +codeToLanguage_["ko"] = "한국말"; +codeToLanguage_["sv"] = "Svenska"; +codeToLanguage_["el"] = "ελληνικά"; +codeToLanguage_["zh"] = "中文"; +codeToLanguage_["ro"] = "Română"; +codeToLanguage_["et"] = "Eesti Keel"; +codeToLanguage_["vi"] = "Tiếng Việt"; +codeToLanguage_["hu"] = "Magyar"; + +let codeToCountry_ = {}; +codeToCountry_["BR"] = "Brasil"; +codeToCountry_["CN"] = "中国"; + +let supportedLocales_ = null; + +let loadedLocales_ = {}; + +let currentLocale_ = 'en_GB'; + +function supportedLocales() { + if (supportedLocales_) return supportedLocales_; + supportedLocales_ = require('../locales/index.json'); + return supportedLocales_; } -function loadLocale(locale) { +function closestSupportedLocale(canonicalName, defaultToEnglish = true) { + const locales = supportedLocales(); + if (locales.indexOf(canonicalName) >= 0) return canonicalName; + + const requiredLanguage = languageCodeOnly(canonicalName).toLowerCase(); + + for (let i = 0; i < locales.length; i++) { + const locale = locales[i]; + const language = locale.split('_')[0]; + if (requiredLanguage == language) return locale; + } + + return defaultToEnglish ? 'en_GB' : null; +} + +function countryName(countryCode) { + return codeToCountry_[countryCode] ? codeToCountry_[countryCode] : ''; +} + + +function languageNameInEnglish(languageCode) { + return codeToLanguageE_[languageCode] ? codeToLanguageE_[languageCode] : ''; +} + + +function languageName(languageCode, defaultToEnglish = true) { + if (codeToLanguage_[languageCode]) return codeToLanguage_[languageCode]; + if (defaultToEnglish) return languageNameInEnglish(languageCode) + return ''; +} + + +function languageCodeOnly(canonicalName) { + if (canonicalName.length < 2) return canonicalName; + return canonicalName.substr(0, 2); +} + + +function countryCodeOnly(canonicalName) { + if (canonicalName.length <= 2) return ""; + return canonicalName.substr(3); +} + +function countryDisplayName(canonicalName) { + const languageCode = languageCodeOnly(canonicalName); + const countryCode = countryCodeOnly(canonicalName); + + let output = languageName(languageCode); + + let extraString; + + if (countryCode != "") { + if (languageCode == "zh" && countryCode == "CN") { + extraString = "简体"; // "Simplified" in "Simplified Chinese" + } else { + extraString = countryName(countryCode); + } + } + + if (languageCode == "zh" && (countryCode == "" || countryCode == "TW")) extraString = "繁體"; // "Traditional" in "Traditional Chinese" + + if (extraString != "") output += " (" + extraString + ")"; + + return output; +} + +function localeStrings(canonicalName) { + const locale = closestSupportedLocale(canonicalName); + if (loadedLocales_[locale]) return loadedLocales_[locale]; + + loadedLocales_[locale] = require('../locales/' + locale + '.json'); + + return loadedLocales_[locale]; } -export { _ }; \ No newline at end of file +function setLocale(canonicalName) { + if (currentLocale_ == canonicalName) return; + currentLocale_ = closestSupportedLocale(canonicalName); +} + +function _(s, ...args) { + let strings = localeStrings(currentLocale_); + + let result = strings[s]; + + if (result === '' || result === undefined) result = s; + return sprintf(result, ...args); +} + +export { _, supportedLocales, localeStrings, setLocale }; \ No newline at end of file diff --git a/ReactNativeClient/lib/models/setting.js b/ReactNativeClient/lib/models/setting.js index 70e1fecad..3f6ad8eb4 100644 --- a/ReactNativeClient/lib/models/setting.js +++ b/ReactNativeClient/lib/models/setting.js @@ -149,6 +149,7 @@ Setting.defaults_ = { 'sync.filesystem.path': { value: '', type: 'string', public: true }, 'sync.target': { value: 'onedrive', type: 'string', public: true }, 'editor': { value: '', type: 'string', public: true }, + 'locale': { value: 'en_GB', type: 'string', public: true }, }; // Contains constants that are set by the application and