mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 21:36:36 +00:00
Store current translations in git (#563)
* Store current translations in git * Handle empty strings in translation downloads * Use more consice filtering * Skip empty keys on translation download
This commit is contained in:
parent
d2faeaffe7
commit
90b80880ed
@ -44,13 +44,21 @@ gulp.task(taskName, function () {
|
||||
src.push(inDir + '/' + lang + '.json');
|
||||
}
|
||||
return gulp.src(src)
|
||||
.pipe(merge({
|
||||
fileName: tr + '.json',
|
||||
}))
|
||||
.pipe(transform(function(data, file) {
|
||||
// Polymer.AppLocalizeBehavior requires flattened json
|
||||
return flatten(data);
|
||||
}))
|
||||
.pipe(transform(function(data, file) {
|
||||
const new_data = {};
|
||||
Object.entries(data).forEach(([key, value]) => {
|
||||
// Filter out empty strings or other falsey values before merging
|
||||
if (data[key]) new_data[key] = value;
|
||||
});
|
||||
return new_data;
|
||||
}))
|
||||
.pipe(merge({
|
||||
fileName: tr + '.json',
|
||||
}))
|
||||
.pipe(minify())
|
||||
.pipe(gulp.dest(outDir));
|
||||
}));
|
||||
@ -87,18 +95,17 @@ gulp.task(taskName, ['build-translation-fingerprints'], function() {
|
||||
])
|
||||
.pipe(merge({}))
|
||||
.pipe(transform(function(data, file) {
|
||||
return Object.keys(data)
|
||||
.filter(key => {
|
||||
if (!data[key]['nativeName']) {
|
||||
const new_data = {};
|
||||
Object.entries(data).forEach(([key, value]) => {
|
||||
// Filter out empty strings or other falsey values before merging
|
||||
if (data[key]['nativeName']) {
|
||||
new_data[key] = data[key];
|
||||
} else {
|
||||
console.warn(`Skipping language ${key}. Native name was not translated.`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.reduce((obj, key) => {
|
||||
obj[key] = data[key];
|
||||
return obj;
|
||||
}, {});
|
||||
}
|
||||
if (data[key]) new_data[key] = value;
|
||||
});
|
||||
return new_data;
|
||||
}))
|
||||
.pipe(insert.wrap('<script>\nwindow.translationMetadata = ', ';\n</script>'))
|
||||
.pipe(rename('translationMetadata.html'))
|
||||
|
@ -11,10 +11,6 @@ OUTPUT_DIR=hass_frontend
|
||||
rm -rf $OUTPUT_DIR
|
||||
cp -r public $OUTPUT_DIR
|
||||
|
||||
# Download latest translations
|
||||
echo "Downloading translations from Lokalise"
|
||||
script/translations_download
|
||||
|
||||
# Build frontend
|
||||
BUILD_DEV=0 ./node_modules/.bin/gulp
|
||||
|
||||
|
@ -11,7 +11,9 @@ cd "$(dirname "$0")/.."
|
||||
if [ ! -f .lokalise_token ] ; then
|
||||
echo "Lokalise API token is required to download the latest set of" \
|
||||
"translations. Please create an account by using the following link:" \
|
||||
"https://lokalise.co/signup/3420425759f6d6d241f598.13594006/all/"
|
||||
"https://lokalise.co/signup/3420425759f6d6d241f598.13594006/all/" \
|
||||
"Place your token in a new file \".lokalise_token\" in the repo" \
|
||||
"root directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -29,6 +31,7 @@ docker run \
|
||||
lokalise/lokalise-cli lokalise \
|
||||
--token ${API_TOKEN} \
|
||||
export ${PROJECT_ID} \
|
||||
--export_empty skip \
|
||||
--type json \
|
||||
--dest /opt/dest
|
||||
|
||||
|
@ -11,7 +11,9 @@ cd "$(dirname "$0")/.."
|
||||
if [ ! -f .lokalise_token ] ; then
|
||||
echo "Lokalise API token is required to download the latest set of" \
|
||||
"translations. Please create an account by using the following link:" \
|
||||
"https://lokalise.co/signup/3420425759f6d6d241f598.13594006/all/"
|
||||
"https://lokalise.co/signup/3420425759f6d6d241f598.13594006/all/" \
|
||||
"Place your token in a new file \".lokalise_token\" in the repo" \
|
||||
"root directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
4
translations/.gitignore
vendored
4
translations/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
4
translations/README.md
Normal file
4
translations/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Translation Resources
|
||||
Translations are managed through [Lokalise](https://lokalise.co/). If you'd like to contribute, you can [join the project here](https://lokalise.co/signup/3420425759f6d6d241f598.13594006/all/). For more details, see our [translation guidelines documentation](https://home-assistant.io/developers/frontend_translation/).
|
||||
|
||||
Don't make changes to these files directly. Instead, use `script/translations_download` to fetch the latest translations from Lokalise.
|
9
translations/bg.json
Normal file
9
translations/bg.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"panel": {
|
||||
"states": "Състояние",
|
||||
"map": "Карта",
|
||||
"logbook": "Дневник",
|
||||
"history": "История",
|
||||
"log_out": "Излез"
|
||||
}
|
||||
}
|
10
translations/cs.json
Normal file
10
translations/cs.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Nastavení",
|
||||
"states": "Stavy",
|
||||
"map": "Mapa",
|
||||
"logbook": "Deník",
|
||||
"history": "Historie",
|
||||
"log_out": "Odhlásit se"
|
||||
}
|
||||
}
|
11
translations/da.json
Normal file
11
translations/da.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Indstillinger",
|
||||
"states": "Oversigt",
|
||||
"map": "Kort",
|
||||
"logbook": "Logbog",
|
||||
"history": "Historik",
|
||||
"log_out": "Log af",
|
||||
"shopping_list": "Indkøbsliste"
|
||||
}
|
||||
}
|
12
translations/de.json
Normal file
12
translations/de.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Konfiguration",
|
||||
"states": "Übersicht",
|
||||
"map": "Karte",
|
||||
"logbook": "Logbuch",
|
||||
"history": "Verlauf",
|
||||
"log_out": "Abmelden",
|
||||
"mailbox": "Posteingang",
|
||||
"shopping_list": "Einkaufsliste"
|
||||
}
|
||||
}
|
10
translations/el.json
Normal file
10
translations/el.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Ρυθμίσεις",
|
||||
"states": "Επισκόπηση",
|
||||
"map": "Χάρτης",
|
||||
"logbook": "Αρχείο Συμβάντων",
|
||||
"history": "Ιστορικό",
|
||||
"log_out": "Αποσύνδεση"
|
||||
}
|
||||
}
|
12
translations/en.json
Normal file
12
translations/en.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Configuration",
|
||||
"states": "Overview",
|
||||
"map": "Map",
|
||||
"logbook": "Logbook",
|
||||
"history": "History",
|
||||
"log_out": "Log Out",
|
||||
"mailbox": "Mailbox",
|
||||
"shopping_list": "Shopping List"
|
||||
}
|
||||
}
|
9
translations/fa.json
Normal file
9
translations/fa.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"panel": {
|
||||
"states": "وضعیت",
|
||||
"map": "نقشه",
|
||||
"logbook": "گزارش روزانه",
|
||||
"history": "تاریخچه",
|
||||
"log_out": "خروج"
|
||||
}
|
||||
}
|
11
translations/fi.json
Normal file
11
translations/fi.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Asetukset",
|
||||
"states": "Yleisnäkymä",
|
||||
"map": "Kartta",
|
||||
"logbook": "Lokikirja",
|
||||
"history": "Historia",
|
||||
"log_out": "Kirjaudu ulos",
|
||||
"shopping_list": "Ostoslista"
|
||||
}
|
||||
}
|
11
translations/fr.json
Normal file
11
translations/fr.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Configuration",
|
||||
"states": "États",
|
||||
"map": "Carte",
|
||||
"logbook": "Journal",
|
||||
"history": "Historique",
|
||||
"log_out": "Déconnexion",
|
||||
"shopping_list": "Liste de courses"
|
||||
}
|
||||
}
|
10
translations/hu.json
Normal file
10
translations/hu.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Konfiguráció",
|
||||
"states": "Áttekintés",
|
||||
"map": "Térkép",
|
||||
"logbook": "Napló",
|
||||
"history": "Előzmények",
|
||||
"log_out": "Kilépés"
|
||||
}
|
||||
}
|
12
translations/it.json
Normal file
12
translations/it.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Configurazione",
|
||||
"states": "Stati",
|
||||
"map": "Mappa",
|
||||
"logbook": "Registro",
|
||||
"history": "Storico",
|
||||
"log_out": "Esci",
|
||||
"mailbox": "Messaggi",
|
||||
"shopping_list": "Lista della spesa"
|
||||
}
|
||||
}
|
9
translations/ja.json
Normal file
9
translations/ja.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"panel": {
|
||||
"states": "状態",
|
||||
"map": "地図",
|
||||
"logbook": "ログブック",
|
||||
"history": "履歴",
|
||||
"log_out": "ログアウト"
|
||||
}
|
||||
}
|
9
translations/lt.json
Normal file
9
translations/lt.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"panel": {
|
||||
"states": "Valdymas",
|
||||
"map": "Žemėlapis",
|
||||
"logbook": "Veiksmų žurnalas",
|
||||
"history": "Istorija",
|
||||
"log_out": "Atsijungti"
|
||||
}
|
||||
}
|
10
translations/nl.json
Normal file
10
translations/nl.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Instellingen",
|
||||
"states": "Overzicht",
|
||||
"map": "Kaart",
|
||||
"logbook": "Logboek",
|
||||
"history": "Geschiedenis",
|
||||
"log_out": "Uitloggen"
|
||||
}
|
||||
}
|
12
translations/no.json
Normal file
12
translations/no.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Innstillinger",
|
||||
"states": "Oversikt",
|
||||
"map": "Kart",
|
||||
"logbook": "Loggbok",
|
||||
"history": "Historie",
|
||||
"log_out": "Logg av",
|
||||
"mailbox": "Postboks",
|
||||
"shopping_list": "Handleliste"
|
||||
}
|
||||
}
|
9
translations/pl.json
Normal file
9
translations/pl.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"panel": {
|
||||
"states": "Stany",
|
||||
"map": "Mapa",
|
||||
"logbook": "Dziennik",
|
||||
"history": "Historia",
|
||||
"log_out": "Wyloguj"
|
||||
}
|
||||
}
|
9
translations/pt.json
Normal file
9
translations/pt.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"panel": {
|
||||
"states": "Estados",
|
||||
"map": "Mapa",
|
||||
"logbook": "Eventos",
|
||||
"history": "Histórico",
|
||||
"log_out": "Desconectar"
|
||||
}
|
||||
}
|
10
translations/ru.json
Normal file
10
translations/ru.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Настройки",
|
||||
"states": "Обзор",
|
||||
"map": "Карта",
|
||||
"logbook": "Журнал",
|
||||
"history": "История",
|
||||
"log_out": "Выход"
|
||||
}
|
||||
}
|
9
translations/sv.json
Normal file
9
translations/sv.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"panel": {
|
||||
"states": "Översikt",
|
||||
"map": "Karta",
|
||||
"logbook": "Loggbok",
|
||||
"history": "Historik",
|
||||
"log_out": "Logga Ut"
|
||||
}
|
||||
}
|
9
translations/th.json
Normal file
9
translations/th.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"panel": {
|
||||
"states": "ภาพรวม",
|
||||
"map": "แผนที่",
|
||||
"logbook": "สมุดบันทึก",
|
||||
"history": "ประวัติ",
|
||||
"log_out": "ลงชื่อออก"
|
||||
}
|
||||
}
|
10
translations/tr.json
Normal file
10
translations/tr.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Ayarlar",
|
||||
"states": "Durum",
|
||||
"map": "Harita",
|
||||
"logbook": "Kayıt Defteri",
|
||||
"history": "Geçmiş",
|
||||
"log_out": "Çıkış Yap"
|
||||
}
|
||||
}
|
10
translations/vi.json
Normal file
10
translations/vi.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "Cấu hình",
|
||||
"states": "Tổng quan",
|
||||
"map": "Bản đồ",
|
||||
"logbook": "Nhật ký",
|
||||
"history": "Lịch sử",
|
||||
"log_out": "Đăng xuất"
|
||||
}
|
||||
}
|
10
translations/zh-Hans.json
Normal file
10
translations/zh-Hans.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "配置",
|
||||
"states": "概览",
|
||||
"map": "地图",
|
||||
"logbook": "日志",
|
||||
"history": "历史",
|
||||
"log_out": "退出"
|
||||
}
|
||||
}
|
10
translations/zh-Hant.json
Normal file
10
translations/zh-Hant.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"panel": {
|
||||
"config": "設定",
|
||||
"states": "概覽",
|
||||
"map": "地圖",
|
||||
"logbook": "日誌",
|
||||
"history": "歷史",
|
||||
"log_out": "登出"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user