Skip to content

Commit

Permalink
refactor(i18n): change .properties format to .json for i18n texts (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-bobev authored Feb 25, 2019
1 parent 25b5585 commit ff93da8
Show file tree
Hide file tree
Showing 88 changed files with 178 additions and 298 deletions.
12 changes: 9 additions & 3 deletions packages/base/src/sap/ui/webcomponents/base/ResourceBundle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ResourceBundle from "@ui5/webcomponents-core/dist/sap/base/i18n/ResourceBundle";
import configuration from "./Configuration";
import { registerModuleContent } from "./ResourceLoaderOverrides";
import { fetchTextOnce } from "./util/FetchHelper";
import { fetchJsonOnce } from "./util/FetchHelper";

const bundleURLs = new Map();
const singletonPromises = new Map();
Expand Down Expand Up @@ -53,8 +53,14 @@ const fetchResourceBundle = async packageId => {

const bundleURL = bundlesForPackage[localeId];

const data = await fetchTextOnce(bundleURL);
registerModuleContent(`${packageId}_${localeId}.properties`, data);
if (typeof bundleURL === "object") {
// inlined from build
registerModuleContent(`${packageId}_${localeId}.properties`, bundleURL._);
return bundleURL;
}

const data = await fetchJsonOnce(bundleURL);
registerModuleContent(`${packageId}_${localeId}.properties`, data._);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"build:docs": "node ../../lib/documentation/index.js",
"clean": "rimraf dist src/build",
"copy:src": "cpx \"src/**/*.js\" dist/",
"copy:i18n": "cpx \"src/i18n/*.properties\" dist/i18n",
"copy:i18n": "cpx \"src/i18n/*.json\" dist/i18n",
"copy:test": "cpx \"test/**/*.*\" dist/test-resources",
"copy:pages": "cpx \"test/**/pages/*.*\" dist/test-resources",
"copy:qunit": "cpx \"test/**/qunit/*.*\" dist/test-resources",
Expand Down
2 changes: 1 addition & 1 deletion packages/main/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ const getPlugins = ({ transpile }) => {
limit: 0,
include: [
/.*cldr\/.*\.json/,
/.*i18n\/.*\.json/,
/.*sap.ui.core.*\/SAP-icons.*/,
/\.properties$/,
],
emitFiles: true,
fileName: "[name].[hash][extname]",
Expand Down
82 changes: 41 additions & 41 deletions packages/main/src/ResourceBundleProvider.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
import { fetchResourceBundle, registerMessageBundles, getResourceBundle } from "@ui5/webcomponents-base/src/sap/ui/webcomponents/base/ResourceBundle";

import ar from "./i18n/messagebundle_ar.properties";
import bg from "./i18n/messagebundle_bg.properties";
import ca from "./i18n/messagebundle_ca.properties";
import cs from "./i18n/messagebundle_cs.properties";
import da from "./i18n/messagebundle_da.properties";
import de from "./i18n/messagebundle_de.properties";
import el from "./i18n/messagebundle_el.properties";
import enUSSappsd from "./i18n/messagebundle_en_US_sappsd.properties";
import enUSSaptrc from "./i18n/messagebundle_en_US_saptrc.properties";
import en from "./i18n/messagebundle_en.properties";
import es from "./i18n/messagebundle_es.properties";
import et from "./i18n/messagebundle_et.properties";
import fi from "./i18n/messagebundle_fi.properties";
import fr from "./i18n/messagebundle_fr.properties";
import hi from "./i18n/messagebundle_hi.properties";
import hr from "./i18n/messagebundle_hr.properties";
import hu from "./i18n/messagebundle_hu.properties";
import it from "./i18n/messagebundle_it.properties";
import iw from "./i18n/messagebundle_iw.properties";
import ja from "./i18n/messagebundle_ja.properties";
import kk from "./i18n/messagebundle_kk.properties";
import ko from "./i18n/messagebundle_ko.properties";
import lt from "./i18n/messagebundle_lt.properties";
import lv from "./i18n/messagebundle_lv.properties";
import ms from "./i18n/messagebundle_ms.properties";
import nl from "./i18n/messagebundle_nl.properties";
import no from "./i18n/messagebundle_no.properties";
import pl from "./i18n/messagebundle_pl.properties";
import pt from "./i18n/messagebundle_pt.properties";
import ro from "./i18n/messagebundle_ro.properties";
import ru from "./i18n/messagebundle_ru.properties";
import sh from "./i18n/messagebundle_sh.properties";
import sk from "./i18n/messagebundle_sk.properties";
import sl from "./i18n/messagebundle_sl.properties";
import sv from "./i18n/messagebundle_sv.properties";
import th from "./i18n/messagebundle_th.properties";
import tr from "./i18n/messagebundle_tr.properties";
import uk from "./i18n/messagebundle_uk.properties";
import vi from "./i18n/messagebundle_vi.properties";
import zhCN from "./i18n/messagebundle_zh_CN.properties";
import zhTW from "./i18n/messagebundle_zh_TW.properties";
import ar from "./i18n/messagebundle_ar.json";
import bg from "./i18n/messagebundle_bg.json";
import ca from "./i18n/messagebundle_ca.json";
import cs from "./i18n/messagebundle_cs.json";
import da from "./i18n/messagebundle_da.json";
import de from "./i18n/messagebundle_de.json";
import el from "./i18n/messagebundle_el.json";
import enUSSappsd from "./i18n/messagebundle_en_US_sappsd.json";
import enUSSaptrc from "./i18n/messagebundle_en_US_saptrc.json";
import en from "./i18n/messagebundle_en.json";
import es from "./i18n/messagebundle_es.json";
import et from "./i18n/messagebundle_et.json";
import fi from "./i18n/messagebundle_fi.json";
import fr from "./i18n/messagebundle_fr.json";
import hi from "./i18n/messagebundle_hi.json";
import hr from "./i18n/messagebundle_hr.json";
import hu from "./i18n/messagebundle_hu.json";
import it from "./i18n/messagebundle_it.json";
import iw from "./i18n/messagebundle_iw.json";
import ja from "./i18n/messagebundle_ja.json";
import kk from "./i18n/messagebundle_kk.json";
import ko from "./i18n/messagebundle_ko.json";
import lt from "./i18n/messagebundle_lt.json";
import lv from "./i18n/messagebundle_lv.json";
import ms from "./i18n/messagebundle_ms.json";
import nl from "./i18n/messagebundle_nl.json";
import no from "./i18n/messagebundle_no.json";
import pl from "./i18n/messagebundle_pl.json";
import pt from "./i18n/messagebundle_pt.json";
import ro from "./i18n/messagebundle_ro.json";
import ru from "./i18n/messagebundle_ru.json";
import sh from "./i18n/messagebundle_sh.json";
import sk from "./i18n/messagebundle_sk.json";
import sl from "./i18n/messagebundle_sl.json";
import sv from "./i18n/messagebundle_sv.json";
import th from "./i18n/messagebundle_th.json";
import tr from "./i18n/messagebundle_tr.json";
import uk from "./i18n/messagebundle_uk.json";
import vi from "./i18n/messagebundle_vi.json";
import zhCN from "./i18n/messagebundle_zh_CN.json";
import zhTW from "./i18n/messagebundle_zh_TW.json";

const bundleMap = {
ar,
Expand Down
3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\r\nTEXTAREA_CHARACTERS_LEFT={0} characters remaining\r\n#XTXT: Text for characters over\r\nTEXTAREA_CHARACTERS_EXCEEDED={0} characters over limit\r\n#XTOL: Tooltip for panel expand title\r\nPANEL_ICON=Expand/Collapse\r\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_ar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT=\\u0645\\u062A\\u0628\\u0642 {0} \\u0645\\u0646 \\u0627\\u0644\\u062D\\u0631\\u0648\\u0641\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED=\\u062A\\u0645 \\u062A\\u062C\\u0627\\u0648\\u0632 \\u0627\\u0644\\u062D\\u062F \\u0628\\u0645\\u0642\\u062F\\u0627\\u0631 {0} \\u0645\\u0646 \\u0627\\u0644\\u062D\\u0631\\u0648\\u0641\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=\\u062A\\u0648\\u0633\\u064A\\u0639/\\u0637\\u064A\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_ar.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_bg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT=\\u041E\\u0441\\u0442\\u0430\\u0432\\u0430\\u0442 {0} \\u0441\\u0438\\u043C\\u0432\\u043E\\u043B\\u0430\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} \\u0441\\u0438\\u043C\\u0432\\u043E\\u043B\\u0430 \\u043D\\u0430\\u0434 \\u043E\\u0433\\u0440\\u0430\\u043D\\u0438\\u0447\\u0435\\u043D\\u0438\\u0435\\u0442\\u043E\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=\\u0420\\u0430\\u0437\\u0448\\u0438\\u0440\\u044F\\u0432\\u0430\\u043D\\u0435/\\u0441\\u043A\\u0440\\u0438\\u0432\\u0430\\u043D\\u0435\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_bg.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_ca.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} car\\u00E0cters restants\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED=S''han excedit {0} car\\u00E0cters\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Ampliar/Comprimir\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_ca.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_cs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} znaky zb\\u00FDvaj\\u00ED\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} znaky p\\u0159es limit\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Rozbalit/sbalit\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_cs.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_da.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} tegn tilbage\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} tegn overskredet\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Ekspander/komprimer\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_da.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} Zeichen verbleibend\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} Zeichen \\u00FCber Limit\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Expandieren/komprimieren\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_de.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_el.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} \\u03B5\\u03BD\\u03B1\\u03C0\\u03BF\\u03BC\\u03B5\\u03AF\\u03BD\\u03B1\\u03BD\\u03C4\\u03B5\\u03C2 \\u03C7\\u03B1\\u03C1\\u03B1\\u03BA\\u03C4\\u03AE\\u03C1\\u03B5\\u03C2\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} \\u03B5\\u03C0\\u03B9\\u03C0\\u03BB\\u03AD\\u03BF\\u03BD \\u03C7\\u03B1\\u03C1\\u03B1\\u03BA\\u03C4\\u03AE\\u03C1\\u03B5\\u03C2\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=\\u0395\\u03C0\\u03AD\\u03BA\\u03C4\\u03B1\\u03C3\\u03B7/\\u03A3\\u03CD\\u03BC\\u03C0\\u03C4\\u03C5\\u03BE\\u03B7\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_el.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} characters remaining\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} characters over limit\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Expand/Collapse\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_en.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_en_US_sappsd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT=[[[{0} \\u010B\\u0125\\u0105\\u0157\\u0105\\u010B\\u0163\\u0113\\u0157\\u015F \\u0157\\u0113\\u0271\\u0105\\u012F\\u014B\\u012F\\u014B\\u011F]]]\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED=[[[{0} \\u010B\\u0125\\u0105\\u0157\\u0105\\u010B\\u0163\\u0113\\u0157\\u015F \\u014F\\u028B\\u0113\\u0157 \\u013A\\u012F\\u0271\\u012F\\u0163]]]\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=[[[\\u0114\\u03C7\\u03C1\\u0105\\u014B\\u018C/\\u0108\\u014F\\u013A\\u013A\\u0105\\u03C1\\u015F\\u0113\\u2219\\u2219\\u2219\\u2219]]]\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_en_US_sappsd.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_en_US_saptrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT=mKEI/SKDBFpaAfahygzAWQ_{0} characters remaining\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED=kicy6IVJJ3K1y6kBW4e6zA_{0} characters over limit\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=fHB0Uj0GByhxzXc7B3D1fw_Expand/Collapse\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_en_US_saptrc.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} caracteres restantes\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} caracteres excedidos\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Ampliar/Comprimir\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_es.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_et.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} m\\u00E4rki veel\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} m\\u00E4rki \\u00FCletatud\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Laienda/ahenda\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_et.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_fi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} merkki\\u00E4 j\\u00E4ljell\\u00E4\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} merkki\\u00E4 yli rajan\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Laajenna/tiivist\\u00E4\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_fi.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} caract\\u00E8re restant\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} caract\\u00E8res de trop\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=D\\u00E9velopper/R\\u00E9duire\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_fr.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_hi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} \\u0936\\u0947\\u0937 \\u0935\\u0930\\u094D\\u0923\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} \\u0938\\u0940\\u092E\\u093E \\u0938\\u0947 \\u0905\\u0927\\u093F\\u0915 \\u0935\\u0930\\u094D\\u0923\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=\\u0935\\u093F\\u0938\\u094D\\u0924\\u0943\\u0924/\\u0938\\u0902\\u0915\\u0941\\u091A\\u093F\\u0924\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_hi.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_hr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} preostali znakovi\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} znakovi prekora\\u010Deni\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Pro\\u0161iri/sa\\u017Emi\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_hr.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_hu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} karakter maradt\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} karakterrel t\\u00FAll\\u00E9pve\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Kibont\\u00E1s / visszaz\\u00E1r\\u00E1s\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_hu.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} caratteri rimanenti\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED={0} caratteri superati\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=Esplodi/Comprimi\n"
}
6 changes: 0 additions & 6 deletions packages/main/src/i18n/messagebundle_it.properties

This file was deleted.

3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle_iw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"_": "#XTXT: Text for characters left\nTEXTAREA_CHARACTERS_LEFT={0} \\u05EA\\u05D5\\u05D5\\u05D9\\u05DD \\u05E0\\u05D5\\u05EA\\u05E8\\u05D5\n#XTXT: Text for characters over\nTEXTAREA_CHARACTERS_EXCEEDED=\\u05D7\\u05E8\\u05D9\\u05D2\\u05D4 \\u05E9\\u05DC {0} \\u05EA\\u05D5\\u05D5\\u05D9\\u05DD\n#XTOL: Tooltip for panel expand title\nPANEL_ICON=\\u05D4\\u05E8\\u05D7\\u05D1/\\u05E6\\u05DE\\u05E6\\u05DD\n"
}
Loading

0 comments on commit ff93da8

Please sign in to comment.