diff --git a/bin/build-locales b/bin/build-locales index 336c5c8fa..7924a2951 100755 --- a/bin/build-locales +++ b/bin/build-locales @@ -34,7 +34,7 @@ */ var async = require('async'); var fs = require('fs'); -var languages = require('../languages.json'); +const languages = require('scratch-l10n').default; var localizedUrls = require('./lib/localized-urls'); var merge = require('lodash.merge'); var defaults = require('lodash.defaults'); diff --git a/bin/configure-fastly.js b/bin/configure-fastly.js index 76e4fdd89..631c79a93 100644 --- a/bin/configure-fastly.js +++ b/bin/configure-fastly.js @@ -1,7 +1,7 @@ var async = require('async'); var defaults = require('lodash.defaults'); var fastlyConfig = require('./lib/fastly-config-methods'); -const languages = require('../languages.json'); +const languages = require('scratch-l10n').default; var routeJson = require('../src/routes.json'); diff --git a/bin/import-pootle b/bin/import-pootle deleted file mode 100755 index 9951ce0c1..000000000 --- a/bin/import-pootle +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env node - /* - Generate language json files corresponding to l10n files to import from - pootle into transifex. - - For example, extract the strings corresponding to splash ids from pootle. - For each language, in localizations/splash create - fr.json => - { - 'splash.welcome' : 'Bienvenue', - ... - } - etc. - */ - -var fs = require('fs'); -var path = require('path'); -var routes = require('../src/routes.json'); -var languages = require('../languages.json'); -var localeCompare = require('./lib/locale-compare'); - -var outputDir = path.resolve(__dirname, '../localizations'); -try { - fs.accessSync(outputDir, fs.F_OK); -} catch (err) { - // Doesn't exist - create it. - fs.mkdirSync(outputDir); -} - -// general is a special case, do it first -var l10n = path.resolve(__dirname, '../src/l10n.json'); -localeCompare.writeTranslations('general', l10n, languages); - -for (var v in routes) { - if (typeof routes[v].redirect !== 'undefined') { - continue; - } - var subdir = routes[v].view.split('/'); - subdir.pop(); - l10n = path.resolve(__dirname, '../src/views/' + subdir.join('/') + '/l10n.json'); - var name = routes[v].name; - try { - // only import if there is an l10n file - fs.accessSync(l10n); - } catch (err) { - // skip views without l10n files - process.stdout.write(`Skipping ${name}, no l10n\n`); - continue; - } - localeCompare.writeTranslations(name, l10n, languages); -} diff --git a/languages.json b/languages.json deleted file mode 100644 index 510c29c69..000000000 --- a/languages.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "ab": "Аҧсшәа", - "ar": "العربية", - "an": "Aragonés", - "ast": "Asturianu", - "id": "Bahasa Indonesia", - "ms": "Bahasa Melayu", - "be": "Беларуская", - "bg": "Български", - "ca": "Català", - "cs": "Česky", - "cy": "Cymraeg", - "da": "Dansk", - "de": "Deutsch", - "yum": "Edible Scratch", - "et": "Eesti", - "el": "Ελληνικά", - "en": "English", - "eo": "Esperanto", - "es": "Español", - "eu": "Euskara", - "fa": "فارسی", - "fr": "Français", - "fur": "Furlan", - "ga": "Gaeilge", - "gd": "Gàidhlig", - "gl": "Galego", - "ko": "한국어", - "hy": "Հայերեն", - "he": "עִבְרִית", - "hi": "हिन्दी", - "hr": "Hrvatski", - "zu": "isiZulu", - "is": "Íslenska", - "it": "Italiano", - "kn": "ಭಾಷೆ-ಹೆಸರು", - "kk": "Қазақша", - "rw": "Kinyarwanda", - "ht": "Kreyòl", - "ku": "Kurdî", - "la": "Latina", - "lv": "Latviešu", - "lt": "Lietuvių", - "mk": "Македонски", - "hu": "Magyar", - "ml": "മലയാളം", - "mt": "Malti", - "cat": "Meow", - "mr": "मराठी", - "mn": "Монгол хэл", - "my": "မြန်မာဘာသာ", - "nl": "Nederlands", - "ja": "日本語", - "nb": "Norsk Bokmål", - "nn": "Norsk Nynorsk", - "uz": "Oʻzbekcha", - "th": "ไทย", - "pl": "Polski", - "pt": "Português", - "pt-br": "Português Brasileiro", - "ro": "Română", - "ru": "Русский", - "sc": "Sardu", - "sq": "Shqip", - "sk": "Slovenčina", - "sl": "Slovenščina", - "sr": "Српски", - "fi": "Suomi", - "sv": "Svenska", - "te": "తెలుగు", - "vi": "Tiếng Việt", - "tr": "Türkçe", - "uk": "Українська", - "zh-cn": "简体中文", - "zh-tw": "繁體中文" -} diff --git a/package.json b/package.json index f71911e5a..d1756c7f1 100644 --- a/package.json +++ b/package.json @@ -103,6 +103,7 @@ "redux-thunk": "2.0.1", "sass-loader": "6.0.6", "scratch-gui": "develop", + "scratch-l10n": "latest", "scratchr2_translations": "git://github.com/LLK/scratchr2_translations.git#master", "slick-carousel": "1.6.0", "source-map-support": "0.3.2", diff --git a/src/components/languagechooser/languagechooser.jsx b/src/components/languagechooser/languagechooser.jsx index 1e9258853..66e4a4262 100644 --- a/src/components/languagechooser/languagechooser.jsx +++ b/src/components/languagechooser/languagechooser.jsx @@ -4,7 +4,7 @@ const PropTypes = require('prop-types'); const React = require('react'); const jar = require('../../lib/jar.js'); -const languages = require('../../../languages.json'); +const languages = require('scratch-l10n').default; const Form = require('../forms/form.jsx'); const Select = require('../forms/select.jsx'); @@ -27,7 +27,7 @@ class LanguageChooser extends React.Component { render () { const languageOptions = Object.keys(this.props.languages).map(value => ({ value: value, - label: this.props.languages[value] + label: this.props.languages[value].name })); return (