Store language native names in git (#556)

* Don't delete the gitignore file

* Store translation native names in git
This commit is contained in:
Adam Mills 2017-11-04 00:31:22 -04:00 committed by Paulus Schoutsen
parent c3a6495eb1
commit 6959b1849f
4 changed files with 77 additions and 52 deletions

View File

@ -29,22 +29,6 @@ function flatten (data) {
return recursive_flatten('', data);
}
var taskName = 'build-translation-native-names';
gulp.task(taskName, function() {
return gulp.src(inDir + '/*.json')
.pipe(transform(function(data, file) {
// Look up the native name for each language and generate a json
// object with all available languages and native names
const lang = path.basename(file.relative, '.json');
return {[lang]: {nativeName: data.language[lang]}};
}))
.pipe(merge({
fileName: 'translationNativeNames.json',
}))
.pipe(gulp.dest('build-temp'));
});
tasks.push(taskName);
var taskName = 'build-merged-translations';
gulp.task(taskName, function () {
return gulp.src(inDir + '/*.json')
@ -63,13 +47,6 @@ gulp.task(taskName, function () {
.pipe(merge({
fileName: tr + '.json',
}))
.pipe(transform(function(data, file) {
// For now, language strings are only used for the native names list. We're deleting
// them from the rolled up translation files for now until we have a more robust
// system for splitting translation strings into multiple resource files.
delete data['language'];
return data;
}))
.pipe(transform(function(data, file) {
// Polymer.AppLocalizeBehavior requires flattened json
return flatten(data);
@ -103,10 +80,10 @@ gulp.task(taskName, ['build-merged-translations'], function() {
tasks.push(taskName);
var taskName = 'build-translations';
gulp.task(taskName, ['build-translation-fingerprints', 'build-translation-native-names'], function() {
gulp.task(taskName, ['build-translation-fingerprints'], function() {
return gulp.src([
'src/translations/translationMetadata.json',
'build-temp/translationFingerprints.json',
'build-temp/translationNativeNames.json',
])
.pipe(merge({}))
.pipe(transform(function(data, file) {

View File

@ -21,7 +21,7 @@ LOCAL_DIR="$(pwd)/translations"
DOWNLOAD_FILE="${LOCAL_DIR}/Home_Assistant_-_Polymer_frontend-locale.zip"
FILE_FORMAT=json
rm -rf ${LOCAL_DIR}
rm -f ${LOCAL_DIR}/*.json
mkdir -p ${LOCAL_DIR}
docker run \

View File

@ -1,30 +1,4 @@
{
"language": {
"bg": "Bulgarian",
"cs": "Czech",
"da": "Danish",
"de": "German",
"el": "Greek",
"en": "English",
"fa": "Persian",
"fi": "Finnish",
"fr": "French",
"hu": "Hungarian",
"it": "Italian",
"ja": "Japanese",
"lt": "Lithuanian",
"nl": "Dutch",
"no": "Norwegian",
"pl": "Polish",
"pt": "Portuguese",
"ru": "Russian",
"sv": "Swedish",
"th": "Thai",
"tr": "Turkish",
"vi": "Vietnamese",
"zh-Hans": "Chinese Simplified",
"zh-Hant": "Chinese Traditional"
},
"panel": {
"config": "Configuration",
"states": "Overview",

View File

@ -0,0 +1,74 @@
{
"bg": {
"nativeName": "Български"
},
"cs": {
"nativeName": "Čeština"
},
"da": {
"nativeName": "Dansk"
},
"de": {
"nativeName": "Deutsch"
},
"el": {
"nativeName": "Ελληνικά"
},
"en": {
"nativeName": "English"
},
"fa": {
"nativeName": "فارسی"
},
"fi": {
"nativeName": "Suomi"
},
"fr": {
"nativeName": "Français"
},
"hu": {
"nativeName": "Magyar"
},
"it": {
"nativeName": "Italiano"
},
"ja": {
"nativeName": "日本語"
},
"lt": {
"nativeName": "Lietuvių"
},
"nl": {
"nativeName": "Nederlands"
},
"no": {
"nativeName": "Norsk"
},
"pl": {
"nativeName": "Polski"
},
"pt": {
"nativeName": "Português"
},
"ru": {
"nativeName": "Русский"
},
"sv": {
"nativeName": "Svenska"
},
"th": {
"nativeName": "ภาษาไทย"
},
"tr": {
"nativeName": "Türkçe"
},
"vi": {
"nativeName": "Tiếng Việt"
},
"zh-Hans": {
"nativeName": "简体中文"
},
"zh-Hant": {
"nativeName": "繁體中文"
}
}