mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-22 15:17:53 -05:00
Make list of languages on www consistent with gui
start to depend on `scratch-l10n` So far only the supported locales is used. There is one small difference between scratch-l10n and the `languages.json` that was removed. languages was: `{locale: ‘languagename’, …}` key value pairs. l10n exports: `{locale: {name: ‘languagename’},…} That required an additional change to the language chooser.
This commit is contained in:
parent
e170a9cd4a
commit
94a8396713
6 changed files with 5 additions and 131 deletions
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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": "繁體中文"
|
||||
}
|
|
@ -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",
|
||||
|
|
|
@ -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 (
|
||||
<Form className={classNames('language-chooser', this.props.className)}>
|
||||
|
|
Loading…
Reference in a new issue