mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
Treansifex and Build/Dist Scripts :shipit:
Finally a sensible and easy solution
This commit is contained in:
parent
d4726cb5fe
commit
2b865a8e3b
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,7 +3,7 @@
|
|||||||
.AppleDouble
|
.AppleDouble
|
||||||
.LSOverride
|
.LSOverride
|
||||||
|
|
||||||
transifexAuth.json
|
.transifexrc
|
||||||
**/css/bourbon
|
**/css/bourbon
|
||||||
**/.sass-cache
|
**/.sass-cache
|
||||||
node_modules/
|
node_modules/
|
17
.tx/config
Normal file
17
.tx/config
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[main]
|
||||||
|
host = https://www.transifex.com
|
||||||
|
|
||||||
|
[gridfieldbulkeditingtools.yml]
|
||||||
|
file_filter = lang/<lang>.yml
|
||||||
|
minimum_perc = 0
|
||||||
|
source_file = lang/en.yml
|
||||||
|
source_lang = en
|
||||||
|
type = YML
|
||||||
|
|
||||||
|
[gridfieldbulkeditingtools.js]
|
||||||
|
file_filter = client/src/lang/<lang>.json
|
||||||
|
minimum_perc = 0
|
||||||
|
source_file = client/src/lang/en.json
|
||||||
|
source_lang = en
|
||||||
|
type = JSON
|
||||||
|
|
@ -48,6 +48,10 @@ $config->addComponent(new \Colymba\BulkManager\BulkManager());
|
|||||||
|
|
||||||
See [BULK_MANAGER.md](docs/en//BULK_MANAGER.md) for detailed configuration.
|
See [BULK_MANAGER.md](docs/en//BULK_MANAGER.md) for detailed configuration.
|
||||||
|
|
||||||
|
## Tooling
|
||||||
|
* `npm run watch` for development
|
||||||
|
* `npm run dist` before pushing to the repo
|
||||||
|
|
||||||
## Translations
|
## Translations
|
||||||
|
|
||||||
Translations of the natural language strings are managed through a third party translation interface, transifex.com.
|
Translations of the natural language strings are managed through a third party translation interface, transifex.com.
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// DO NOT MODIFY. Generated by build task.
|
|
||||||
// Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
} else {
|
} else {
|
||||||
ss.i18n.addDictionary('cs', {
|
ss.i18n.addDictionary(cs, {
|
||||||
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Uploading %s file(s). %s done. %s error(s).",
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Uploading %s file(s). %s done. %s error(s).",
|
||||||
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Musíte vybrat alespoň jednu položku.",
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Musíte vybrat alespoň jednu položku.",
|
||||||
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Data budou nenávratně ztracena. Opravdu chcete pokračovat?"
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Data budou nenávratně ztracena. Opravdu chcete pokračovat?"
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// DO NOT MODIFY. Generated by build task.
|
|
||||||
// Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
} else {
|
} else {
|
||||||
ss.i18n.addDictionary('de', {
|
ss.i18n.addDictionary(de, {
|
||||||
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Übertrage %s Datei(en). %s erfolgreich übertragen. %s Fehler.",
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Übertrage %s Datei(en). %s erfolgreich übertragen. %s Fehler.",
|
||||||
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Sie müssen mindestens ein Element auswählen.",
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Sie müssen mindestens ein Element auswählen.",
|
||||||
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Wollen Sie dieses Element wirklich unwiderruflich löschen?"
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Wollen Sie dieses Element wirklich unwiderruflich löschen?"
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
// DO NOT MODIFY. Generated by build task.
|
|
||||||
// Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
} else {
|
} else {
|
||||||
ss.i18n.addDictionary('en', {
|
ss.i18n.addDictionary(en, {
|
||||||
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Uploading %s file(s). %s done. %s error(s).",
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Uploading %s file(s). %s done. %s error(s).",
|
||||||
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "You must select at least one record.",
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "You must select at least one record.",
|
||||||
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "The data will be lost permanently. Do you want to continue?"
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "The data will be lost permanently. Do you want to continue?"
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -1,9 +1,7 @@
|
|||||||
// DO NOT MODIFY. Generated by build task.
|
|
||||||
// Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
} else {
|
} else {
|
||||||
ss.i18n.addDictionary('fi', {
|
ss.i18n.addDictionary(fi, {
|
||||||
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Lataa %s tiedosto(ja). %s Valmis. %s virhe(itä).",
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Lataa %s tiedosto(ja). %s Valmis. %s virhe(itä).",
|
||||||
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Sinun täytyy valita vähintään yksi tallenne. ",
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Sinun täytyy valita vähintään yksi tallenne. ",
|
||||||
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Tiedostosi häviävät pysyvästi. Haluatko jatkaa?"
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Tiedostosi häviävät pysyvästi. Haluatko jatkaa?"
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// DO NOT MODIFY. Generated by build task.
|
|
||||||
// Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
} else {
|
} else {
|
||||||
ss.i18n.addDictionary('fr', {
|
ss.i18n.addDictionary(fr, {
|
||||||
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "%s fichier(s) en transfert. %s terminer. %s erreur(s).",
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "%s fichier(s) en transfert. %s terminer. %s erreur(s).",
|
||||||
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Vous devez sélectionner au moins une entrée.",
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Vous devez sélectionner au moins une entrée.",
|
||||||
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Les données serons perdu définitivement. Voulez vous continuer?"
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Les données serons perdu définitivement. Voulez vous continuer?"
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// DO NOT MODIFY. Generated by build task.
|
|
||||||
// Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
} else {
|
} else {
|
||||||
ss.i18n.addDictionary('it', {
|
ss.i18n.addDictionary(it, {
|
||||||
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Caricamento del/dei file(s) %s. %s completato. %s errore(i).",
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Caricamento del/dei file(s) %s. %s completato. %s errore(i).",
|
||||||
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Devi selezionare almeno una voce.",
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Devi selezionare almeno una voce.",
|
||||||
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "I dati saranno persi per sempre. Vuoi continuare?"
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "I dati saranno persi per sempre. Vuoi continuare?"
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// DO NOT MODIFY. Generated by build task.
|
|
||||||
// Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
} else {
|
} else {
|
||||||
ss.i18n.addDictionary('nl', {
|
ss.i18n.addDictionary(nl, {
|
||||||
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Uploading %s file(s). %s done. %s error(s).",
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Uploading %s file(s). %s done. %s error(s).",
|
||||||
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "U moet minstens een item te selecteren.",
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "U moet minstens een item te selecteren.",
|
||||||
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "De gegevens zullen permanent verloren. Weet je zeker dat je de pagina wilt verlaten?"
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "De gegevens zullen permanent verloren. Weet je zeker dat je de pagina wilt verlaten?"
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// DO NOT MODIFY. Generated by build task.
|
|
||||||
// Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
} else {
|
} else {
|
||||||
ss.i18n.addDictionary('pl', {
|
ss.i18n.addDictionary(pl, {
|
||||||
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Wgrywanie %s plików. Ukończono %s. %s błędów.",
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Wgrywanie %s plików. Ukończono %s. %s błędów.",
|
||||||
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Musisz wybrać przynajmniej jedną pozycję.",
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Musisz wybrać przynajmniej jedną pozycję.",
|
||||||
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Dane zostaną bezpowrotnie usunięte. Czy chcesz kontynuować?"
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Dane zostaną bezpowrotnie usunięte. Czy chcesz kontynuować?"
|
||||||
|
9
client/lang/ru.js
Normal file
9
client/lang/ru.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
|
} else {
|
||||||
|
ss.i18n.addDictionary(ru, {
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Загружается %s файл(ов). %s завершено. %s ошибка(и).",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Вы должны выбрать как минимум одну запись.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Ваши данные будут безвозвратно удалены. Вы хотите продолжить?"
|
||||||
|
});
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
// DO NOT MODIFY. Generated by build task.
|
|
||||||
// Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
} else {
|
} else {
|
||||||
ss.i18n.addDictionary('sk', {
|
ss.i18n.addDictionary(sk, {
|
||||||
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Nahrávam %s súbor(y/ov). %s hotovo. %s chyb(a/y).",
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Nahrávam %s súbor(y/ov). %s hotovo. %s chyb(a/y).",
|
||||||
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Musíte vybrať aspoň jednu položku.",
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Musíte vybrať aspoň jednu položku.",
|
||||||
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Dáta budú nenávratne stratené. Chcete pokračovať?"
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Dáta budú nenávratne stratené. Chcete pokračovať?"
|
||||||
|
5
client/src/lang/cs.json
Normal file
5
client/src/lang/cs.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Uploading %s file(s). %s done. %s error(s).",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Musíte vybrat alespoň jednu položku.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Data budou nenávratně ztracena. Opravdu chcete pokračovat?"
|
||||||
|
}
|
5
client/src/lang/de.json
Normal file
5
client/src/lang/de.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Übertrage %s Datei(en). %s erfolgreich übertragen. %s Fehler.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Sie müssen mindestens ein Element auswählen.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Wollen Sie dieses Element wirklich unwiderruflich löschen?"
|
||||||
|
}
|
5
client/src/lang/fi.json
Normal file
5
client/src/lang/fi.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Lataa %s tiedosto(ja). %s Valmis. %s virhe(itä).",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Sinun täytyy valita vähintään yksi tallenne. ",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Tiedostosi häviävät pysyvästi. Haluatko jatkaa?"
|
||||||
|
}
|
5
client/src/lang/fr.json
Normal file
5
client/src/lang/fr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "%s fichier(s) en transfert. %s terminer. %s erreur(s).",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Vous devez sélectionner au moins une entrée.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Les données serons perdu définitivement. Voulez vous continuer?"
|
||||||
|
}
|
5
client/src/lang/it.json
Normal file
5
client/src/lang/it.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Caricamento del/dei file(s) %s. %s completato. %s errore(i).",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Devi selezionare almeno una voce.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "I dati saranno persi per sempre. Vuoi continuare?"
|
||||||
|
}
|
5
client/src/lang/nl.json
Normal file
5
client/src/lang/nl.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Uploading %s file(s). %s done. %s error(s).",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "U moet minstens een item te selecteren.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "De gegevens zullen permanent verloren. Weet je zeker dat je de pagina wilt verlaten?"
|
||||||
|
}
|
5
client/src/lang/pl.json
Normal file
5
client/src/lang/pl.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Wgrywanie %s plików. Ukończono %s. %s błędów.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Musisz wybrać przynajmniej jedną pozycję.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Dane zostaną bezpowrotnie usunięte. Czy chcesz kontynuować?"
|
||||||
|
}
|
5
client/src/lang/ru.json
Normal file
5
client/src/lang/ru.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Загружается %s файл(ов). %s завершено. %s ошибка(и).",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Вы должны выбрать как минимум одну запись.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Ваши данные будут безвозвратно удалены. Вы хотите продолжить?"
|
||||||
|
}
|
5
client/src/lang/sk.json
Normal file
5
client/src/lang/sk.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO": "Nahrávam %s súbor(y/ov). %s hotovo. %s chyb(a/y).",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT": "Musíte vybrať aspoň jednu položku.",
|
||||||
|
"GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION": "Dáta budú nenávratne stratené. Chcete pokračovať?"
|
||||||
|
}
|
@ -1,10 +1,4 @@
|
|||||||
# DO NOT MODIFY. Generated by build task.
|
|
||||||
# Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
cs:
|
cs:
|
||||||
GRIDFIELD_BULK_UPLOAD:
|
|
||||||
FINISH_BTN_LABEL: Dokončit
|
|
||||||
CANCEL_BTN_LABEL: Storno
|
|
||||||
EDIT_ALL_BTN_LABEL: Upravit vše
|
|
||||||
GRIDFIELD_BULK_MANAGER:
|
GRIDFIELD_BULK_MANAGER:
|
||||||
EDIT_SELECT_LABEL: Upravit
|
EDIT_SELECT_LABEL: Upravit
|
||||||
UNLINK_SELECT_LABEL: Odstranit vazbu
|
UNLINK_SELECT_LABEL: Odstranit vazbu
|
||||||
@ -13,4 +7,4 @@ cs:
|
|||||||
SELECT_ALL_LABEL: Vybrat vše
|
SELECT_ALL_LABEL: Vybrat vše
|
||||||
GRIDFIELD_BULKMANAGER_EDIT_HANDLER:
|
GRIDFIELD_BULKMANAGER_EDIT_HANDLER:
|
||||||
SAVE_BTN_LABEL: Uložit vše
|
SAVE_BTN_LABEL: Uložit vše
|
||||||
CANCEL_BTN_LABEL: Storno
|
CANCEL_BTN_LABEL: Storno
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
# DO NOT MODIFY. Generated by build task.
|
|
||||||
# Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
de:
|
de:
|
||||||
GRIDFIELD_BULK_UPLOAD:
|
|
||||||
FINISH_BTN_LABEL: Fertigstellen
|
|
||||||
CANCEL_BTN_LABEL: Abbrechen
|
|
||||||
CLEAR_ERROR_BTN_LABEL: Fehler löschen
|
|
||||||
EDIT_ALL_BTN_LABEL: Alle bearbeiten
|
|
||||||
GRIDFIELD_BULK_MANAGER:
|
GRIDFIELD_BULK_MANAGER:
|
||||||
COMPONENT_TITLE: Einen oder mehrere Einträge gleichzeitig bearbeiten
|
COMPONENT_TITLE: Einen oder mehrere Einträge gleichzeitig bearbeiten
|
||||||
EDIT_SELECT_LABEL: Bearbeiten
|
EDIT_SELECT_LABEL: Bearbeiten
|
||||||
@ -18,4 +11,4 @@ de:
|
|||||||
TOGGLE_ALL_LINK: Alle Anzeigen/Verbergen
|
TOGGLE_ALL_LINK: Alle Anzeigen/Verbergen
|
||||||
SAVE_BTN_LABEL: Alle speichern
|
SAVE_BTN_LABEL: Alle speichern
|
||||||
CANCEL_BTN_LABEL: Abbrechen
|
CANCEL_BTN_LABEL: Abbrechen
|
||||||
SAVE_RESULT_TEXT: '{count} {class} erfolgreich gespeichert.'
|
SAVE_RESULT_TEXT: '{count} {class} erfolgreich gespeichert.'
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
en:
|
en:
|
||||||
GRIDFIELD_BULK_UPLOAD:
|
GRIDFIELD_BULK_UPLOAD:
|
||||||
FINISH_BTN_LABEL: Finish
|
|
||||||
CANCEL_BTN_LABEL: Cancel
|
|
||||||
CLEAR_ERROR_BTN_LABEL: Clear errors
|
|
||||||
EDIT_ALL_BTN_LABEL: Edit all
|
|
||||||
GRIDFIELD_BULK_MANAGER:
|
GRIDFIELD_BULK_MANAGER:
|
||||||
COMPONENT_TITLE: Modify one or more entry at a time.
|
COMPONENT_TITLE: Modify one or more entry at a time.
|
||||||
EDIT_SELECT_LABEL: Edit
|
EDIT_SELECT_LABEL: Edit
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
# DO NOT MODIFY. Generated by build task.
|
|
||||||
# Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
fi:
|
fi:
|
||||||
GRIDFIELD_BULK_UPLOAD:
|
|
||||||
FINISH_BTN_LABEL: Valmis
|
|
||||||
CANCEL_BTN_LABEL: Peruuta
|
|
||||||
CLEAR_ERROR_BTN_LABEL: Selvitä virheet
|
|
||||||
EDIT_ALL_BTN_LABEL: Muokkaa kaikki
|
|
||||||
GRIDFIELD_BULK_MANAGER:
|
GRIDFIELD_BULK_MANAGER:
|
||||||
COMPONENT_TITLE: Muokkaa yhtä tai useampaa merkintää kerrallaan.
|
COMPONENT_TITLE: Muokkaa yhtä tai useampaa merkintää kerrallaan.
|
||||||
EDIT_SELECT_LABEL: Muokkaa
|
EDIT_SELECT_LABEL: Muokkaa
|
||||||
@ -17,4 +10,4 @@ fi:
|
|||||||
HEADER_TEXT: Muokkaa {count} {class}
|
HEADER_TEXT: Muokkaa {count} {class}
|
||||||
TOGGLE_ALL_LINK: Näytä/Piilota kaikki
|
TOGGLE_ALL_LINK: Näytä/Piilota kaikki
|
||||||
SAVE_BTN_LABEL: Tallenna kaikki
|
SAVE_BTN_LABEL: Tallenna kaikki
|
||||||
CANCEL_BTN_LABEL: Peruuta
|
CANCEL_BTN_LABEL: Peruuta
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
# DO NOT MODIFY. Generated by build task.
|
|
||||||
# Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
fr:
|
fr:
|
||||||
GRIDFIELD_BULK_UPLOAD:
|
|
||||||
FINISH_BTN_LABEL: Terminer
|
|
||||||
CANCEL_BTN_LABEL: Annuler
|
|
||||||
CLEAR_ERROR_BTN_LABEL: Effacer les erreurs
|
|
||||||
EDIT_ALL_BTN_LABEL: Tout éditer
|
|
||||||
GRIDFIELD_BULK_MANAGER:
|
GRIDFIELD_BULK_MANAGER:
|
||||||
COMPONENT_TITLE: Modifier une ou plusieurs entrée à la fois.
|
COMPONENT_TITLE: Modifier une ou plusieurs entrée à la fois.
|
||||||
EDIT_SELECT_LABEL: Editer
|
EDIT_SELECT_LABEL: Editer
|
||||||
@ -18,4 +11,4 @@ fr:
|
|||||||
TOGGLE_ALL_LINK: Afficher/Masquer tout
|
TOGGLE_ALL_LINK: Afficher/Masquer tout
|
||||||
SAVE_BTN_LABEL: Sauvegarder tout
|
SAVE_BTN_LABEL: Sauvegarder tout
|
||||||
CANCEL_BTN_LABEL: Annuler
|
CANCEL_BTN_LABEL: Annuler
|
||||||
SAVE_RESULT_TEXT: '{count} {class} sauvegardés avec succès.'
|
SAVE_RESULT_TEXT: '{count} {class} sauvegardés avec succès.'
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
# DO NOT MODIFY. Generated by build task.
|
|
||||||
# Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
it:
|
it:
|
||||||
GRIDFIELD_BULK_UPLOAD:
|
|
||||||
FINISH_BTN_LABEL: Termina
|
|
||||||
CANCEL_BTN_LABEL: Annulla
|
|
||||||
CLEAR_ERROR_BTN_LABEL: Cancella errori
|
|
||||||
EDIT_ALL_BTN_LABEL: Modifica tutti
|
|
||||||
GRIDFIELD_BULK_MANAGER:
|
GRIDFIELD_BULK_MANAGER:
|
||||||
COMPONENT_TITLE: Modifica una o più voci alla volta.
|
COMPONENT_TITLE: Modifica una o più voci alla volta.
|
||||||
EDIT_SELECT_LABEL: Modifica
|
EDIT_SELECT_LABEL: Modifica
|
||||||
@ -18,4 +11,4 @@ it:
|
|||||||
TOGGLE_ALL_LINK: Mostra/Nascondi tutto
|
TOGGLE_ALL_LINK: Mostra/Nascondi tutto
|
||||||
SAVE_BTN_LABEL: Salva tutto
|
SAVE_BTN_LABEL: Salva tutto
|
||||||
CANCEL_BTN_LABEL: Annulla
|
CANCEL_BTN_LABEL: Annulla
|
||||||
SAVE_RESULT_TEXT: '{count} {class} salvati con successo.'
|
SAVE_RESULT_TEXT: '{count} {class} salvati con successo.'
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
# DO NOT MODIFY. Generated by build task.
|
|
||||||
# Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
nl:
|
nl:
|
||||||
GRIDFIELD_BULK_UPLOAD:
|
|
||||||
FINISH_BTN_LABEL: Afronden
|
|
||||||
CANCEL_BTN_LABEL: Annuleren
|
|
||||||
CLEAR_ERROR_BTN_LABEL: Verwijder fouten
|
|
||||||
EDIT_ALL_BTN_LABEL: Alles bewerken
|
|
||||||
GRIDFIELD_BULK_MANAGER:
|
GRIDFIELD_BULK_MANAGER:
|
||||||
COMPONENT_TITLE: Bewerk één of meerdere items tegelijkertijd
|
COMPONENT_TITLE: Bewerk één of meerdere items tegelijkertijd
|
||||||
EDIT_SELECT_LABEL: Bewerken
|
EDIT_SELECT_LABEL: Bewerken
|
||||||
@ -17,4 +10,4 @@ nl:
|
|||||||
HEADER_TEXT: '{count} {class} aan het bewerken'
|
HEADER_TEXT: '{count} {class} aan het bewerken'
|
||||||
TOGGLE_ALL_LINK: Toon/verberg alle
|
TOGGLE_ALL_LINK: Toon/verberg alle
|
||||||
SAVE_BTN_LABEL: Alles opslaan
|
SAVE_BTN_LABEL: Alles opslaan
|
||||||
CANCEL_BTN_LABEL: Annuleren
|
CANCEL_BTN_LABEL: Annuleren
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
# DO NOT MODIFY. Generated by build task.
|
|
||||||
# Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
pl:
|
pl:
|
||||||
GRIDFIELD_BULK_UPLOAD:
|
|
||||||
FINISH_BTN_LABEL: Zakończ
|
|
||||||
CANCEL_BTN_LABEL: Anuluj
|
|
||||||
CLEAR_ERROR_BTN_LABEL: Usuń błędy
|
|
||||||
EDIT_ALL_BTN_LABEL: Edytuj wszystkie
|
|
||||||
GRIDFIELD_BULK_MANAGER:
|
GRIDFIELD_BULK_MANAGER:
|
||||||
COMPONENT_TITLE: Modyfikuj jednocześnie jedną lub więcej pozycji.
|
COMPONENT_TITLE: Modyfikuj jednocześnie jedną lub więcej pozycji.
|
||||||
EDIT_SELECT_LABEL: Edytuj
|
EDIT_SELECT_LABEL: Edytuj
|
||||||
@ -18,4 +11,4 @@ pl:
|
|||||||
TOGGLE_ALL_LINK: Pokaż/ukryj wszystkie
|
TOGGLE_ALL_LINK: Pokaż/ukryj wszystkie
|
||||||
SAVE_BTN_LABEL: Zapisz wszystkie
|
SAVE_BTN_LABEL: Zapisz wszystkie
|
||||||
CANCEL_BTN_LABEL: Anuluj
|
CANCEL_BTN_LABEL: Anuluj
|
||||||
SAVE_RESULT_TEXT: 'Zapisano pomyślnie {count} {class}'
|
SAVE_RESULT_TEXT: 'Zapisano pomyślnie {count} {class}'
|
||||||
|
14
lang/ru.yml
Normal file
14
lang/ru.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
ru:
|
||||||
|
GRIDFIELD_BULK_MANAGER:
|
||||||
|
COMPONENT_TITLE: Редактировать одну или несколько записей одновременно
|
||||||
|
EDIT_SELECT_LABEL: Редактировать
|
||||||
|
UNLINK_SELECT_LABEL: Отвязать
|
||||||
|
DELETE_SELECT_LABEL: Удалить
|
||||||
|
ACTION_BTN_LABEL: Поехали
|
||||||
|
SELECT_ALL_LABEL: Выбрать все
|
||||||
|
GRIDFIELD_BULKMANAGER_EDIT_HANDLER:
|
||||||
|
HEADER_TEXT: Редактировать {count} {class}
|
||||||
|
TOGGLE_ALL_LINK: Показать/Скрыть все
|
||||||
|
SAVE_BTN_LABEL: Сохранить все
|
||||||
|
CANCEL_BTN_LABEL: Отменить
|
||||||
|
SAVE_RESULT_TEXT: '{count} {class} успешно сохранены'
|
@ -1,11 +1,4 @@
|
|||||||
# DO NOT MODIFY. Generated by build task.
|
|
||||||
# Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
sk:
|
sk:
|
||||||
GRIDFIELD_BULK_UPLOAD:
|
|
||||||
FINISH_BTN_LABEL: Dokončiť
|
|
||||||
CANCEL_BTN_LABEL: Zrušiť
|
|
||||||
CLEAR_ERROR_BTN_LABEL: Vymazať chyby
|
|
||||||
EDIT_ALL_BTN_LABEL: Upraviť všetky
|
|
||||||
GRIDFIELD_BULK_MANAGER:
|
GRIDFIELD_BULK_MANAGER:
|
||||||
COMPONENT_TITLE: Uprav jednu alebo viac položiek súčasne.
|
COMPONENT_TITLE: Uprav jednu alebo viac položiek súčasne.
|
||||||
EDIT_SELECT_LABEL: Upraviť
|
EDIT_SELECT_LABEL: Upraviť
|
||||||
@ -18,4 +11,4 @@ sk:
|
|||||||
TOGGLE_ALL_LINK: Zobraziť/Skryť všetko
|
TOGGLE_ALL_LINK: Zobraziť/Skryť všetko
|
||||||
SAVE_BTN_LABEL: Uložiť všetko
|
SAVE_BTN_LABEL: Uložiť všetko
|
||||||
CANCEL_BTN_LABEL: Zrušiť
|
CANCEL_BTN_LABEL: Zrušiť
|
||||||
SAVE_RESULT_TEXT: '{count} {class} úspešne uložené.'
|
SAVE_RESULT_TEXT: '{count} {class} úspešne uložené.'
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "NODE_ENV=production webpack -p --bail --progress",
|
"build": "NODE_ENV=production webpack -p --bail --progress",
|
||||||
"watch": "NODE_ENV=development webpack --watch --progress"
|
"watch": "NODE_ENV=development webpack --watch --progress",
|
||||||
|
"tx": "tx push --source && tx pull --all && node transifex.js",
|
||||||
|
"dist": "npm run tx && npm run build"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -1,289 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Phing build task used to generate SilverStripe translation files
|
|
||||||
* from Transifex data. This tasks assumes that:
|
|
||||||
* - Javascript translations are from the Transifex resource called 'js'
|
|
||||||
* - YML translations are from the Transifex resource called 'yml'
|
|
||||||
* - Transifex AUTH credentials to be saved in $txAuthFile with content {"username": "user", "password": "pwd"}.
|
|
||||||
*
|
|
||||||
* This is inspired by SilverStripe build tools. Thanks
|
|
||||||
*
|
|
||||||
* @see https://github.com/silverstripe/silverstripe-buildtools/blob/master/src/GenerateJavascriptI18nTask.php
|
|
||||||
*/
|
|
||||||
// Ignore this file if phing is not installed
|
|
||||||
if (!class_exists('Task')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
include_once 'phing/Task.php';
|
|
||||||
|
|
||||||
class BuildTransifexTranslations extends Task
|
|
||||||
{
|
|
||||||
private $txapi = 'https://www.transifex.com/api/2';
|
|
||||||
private $txproject = '';
|
|
||||||
private $txAuthFile = 'transifexAuth.json';
|
|
||||||
private $txAuth = null;
|
|
||||||
|
|
||||||
private $root = '';
|
|
||||||
private $jsDir = '/lang/js';
|
|
||||||
private $ymlDir = '/lang';
|
|
||||||
|
|
||||||
public function settxapi($txapi)
|
|
||||||
{
|
|
||||||
$this->txapi = $txapi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function settxproject($txproject)
|
|
||||||
{
|
|
||||||
$this->txproject = $txproject;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Task init.
|
|
||||||
*/
|
|
||||||
public function init()
|
|
||||||
{
|
|
||||||
$root = realpath(__DIR__.DIRECTORY_SEPARATOR.'..');
|
|
||||||
$authFile = $root.DIRECTORY_SEPARATOR.$this->txAuthFile;
|
|
||||||
|
|
||||||
if (file_exists($authFile)) {
|
|
||||||
$txAuthData = file_get_contents($authFile);
|
|
||||||
$txAuthData = json_decode($txAuthData);
|
|
||||||
if ($txAuthData->username && $txAuthData->password) {
|
|
||||||
$this->txAuth = $txAuthData;
|
|
||||||
} else {
|
|
||||||
throw new BuildException("Transifex credentials malformat. Check your $authFile for 'username' and 'password' keys.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new BuildException("Transifex credentials not found. $authFile missing.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->root = $root;
|
|
||||||
$this->jsDir = $root.$this->jsDir;
|
|
||||||
$this->ymlDir = $root.$this->ymlDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Let's get to buisness...
|
|
||||||
*/
|
|
||||||
public function main()
|
|
||||||
{
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
||||||
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
|
||||||
curl_setopt($ch, CURLOPT_USERPWD, $this->txAuth->username.':'.$this->txAuth->password);
|
|
||||||
|
|
||||||
// get resources
|
|
||||||
$url = $this->txapi.'/project/'.$this->txproject.'/resources/';
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
$resources = curl_exec($ch);
|
|
||||||
|
|
||||||
if (!$resources) {
|
|
||||||
throw new BuildException('Cannot fetch resources');
|
|
||||||
} else {
|
|
||||||
$resources = json_decode($resources);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get langs
|
|
||||||
$url = $this->txapi.'/project/'.$this->txproject.'/languages/';
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
$languages = curl_exec($ch);
|
|
||||||
|
|
||||||
if (!$languages) {
|
|
||||||
throw new BuildException('Cannot fetch languages');
|
|
||||||
} else {
|
|
||||||
$languages = json_decode($languages);
|
|
||||||
}
|
|
||||||
|
|
||||||
// clear existing translation files and/or setup folders
|
|
||||||
$this->resetTranslations();
|
|
||||||
|
|
||||||
// add source_language_code to languages list
|
|
||||||
$sourceLangs = array();
|
|
||||||
foreach ($resources as $resource) {
|
|
||||||
$lang = new StdClass();
|
|
||||||
$locale = $resource->source_language_code;
|
|
||||||
$lang->language_code = $locale;
|
|
||||||
if (!array_key_exists($locale, $sourceLangs)) {
|
|
||||||
$sourceLangs[$locale] = $lang;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$sourceLangs = array_values($sourceLangs);
|
|
||||||
$languages = array_merge($languages, $sourceLangs);
|
|
||||||
|
|
||||||
// get each resource translations
|
|
||||||
foreach ($resources as $resource) {
|
|
||||||
foreach ($languages as $language) {
|
|
||||||
$url = $this->txapi.'/project/'.$this->txproject.'/resource/'.$resource->slug.'/translation/'.$language->language_code;
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
$data = curl_exec($ch);
|
|
||||||
if ($data) {
|
|
||||||
$this->saveTranslation($resource->slug, $language->language_code, $data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
curl_close($ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear any existing translation files
|
|
||||||
* and create directory structure if needed.
|
|
||||||
*/
|
|
||||||
private function resetTranslations()
|
|
||||||
{
|
|
||||||
if (file_exists($this->jsDir)) {
|
|
||||||
echo "Clearing js translations...\n";
|
|
||||||
$iterator = new GlobIterator($this->jsDir.DIRECTORY_SEPARATOR.'*.js');
|
|
||||||
foreach ($iterator as $fileInfo) {
|
|
||||||
if ($fileInfo->isFile()) {
|
|
||||||
$del = unlink($fileInfo->getRealPath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists($this->ymlDir)) {
|
|
||||||
echo "Clearing yml translations...\n";
|
|
||||||
$iterator = new GlobIterator($this->ymlDir.DIRECTORY_SEPARATOR.'*.yml');
|
|
||||||
foreach ($iterator as $fileInfo) {
|
|
||||||
if ($fileInfo->isFile()) {
|
|
||||||
$del = unlink($fileInfo->getRealPath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!file_exists($this->jsDir)) {
|
|
||||||
echo "Creating js folders...\n";
|
|
||||||
mkdir($this->jsDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!file_exists($this->ymlDir)) {
|
|
||||||
echo "Creating yml folders...\n";
|
|
||||||
mkdir($this->ymlDir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hook that detect the translation type via resource slug
|
|
||||||
* and call corect saving function with data.
|
|
||||||
*
|
|
||||||
* @param string $resource Transifex resrouce slug
|
|
||||||
* @param string $locale Transifex locale
|
|
||||||
* @param string $data Raw Transifex translation data
|
|
||||||
*/
|
|
||||||
private function saveTranslation($resource, $locale, $data)
|
|
||||||
{
|
|
||||||
if (!$resource || !$locale || !$data) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = json_decode($data);
|
|
||||||
$translation = rtrim($data->content);
|
|
||||||
|
|
||||||
switch ($resource) {
|
|
||||||
case 'js':
|
|
||||||
$this->saveJSTranslation($locale, $translation);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'yml':
|
|
||||||
$this->saveYMLTranslation($locale, $translation);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save a JS translation file
|
|
||||||
* Uses JSTemplate to fit with SilverStripe requirements.
|
|
||||||
*
|
|
||||||
* @param string $locale Locale code
|
|
||||||
* @param string $json JSON translation key:value
|
|
||||||
*/
|
|
||||||
private function saveJSTranslation($locale, $json)
|
|
||||||
{
|
|
||||||
echo "Saving $locale.js\n";
|
|
||||||
file_put_contents(
|
|
||||||
$this->jsDir.DIRECTORY_SEPARATOR.$locale.'.js',
|
|
||||||
$this->getBanner('js').
|
|
||||||
str_replace(
|
|
||||||
array(
|
|
||||||
'%TRANSLATIONS%',
|
|
||||||
'%LOCALE%',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
$json,
|
|
||||||
$locale,
|
|
||||||
),
|
|
||||||
$this->getJSTemplate()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save a YML translation file.
|
|
||||||
*
|
|
||||||
* @param string $locale Locale code
|
|
||||||
* @param string $yml YML translation
|
|
||||||
*/
|
|
||||||
public function saveYMLTranslation($locale, $yml)
|
|
||||||
{
|
|
||||||
echo "Saving $locale.yml\n";
|
|
||||||
|
|
||||||
if ($locale !== 'en') {
|
|
||||||
$content = $this->getBanner('yml').$yml;
|
|
||||||
} else {
|
|
||||||
$content = $yml;
|
|
||||||
}
|
|
||||||
|
|
||||||
file_put_contents(
|
|
||||||
$this->ymlDir.DIRECTORY_SEPARATOR.$locale.'.yml',
|
|
||||||
$content
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the commented file banner.
|
|
||||||
*
|
|
||||||
* @param string $type File type e.g js
|
|
||||||
*
|
|
||||||
* @return string The commented file banner
|
|
||||||
*/
|
|
||||||
private function getBanner($type)
|
|
||||||
{
|
|
||||||
switch (strtolower($type)) {
|
|
||||||
case 'yml':
|
|
||||||
$comment = '#';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$comment = '//';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$banner = <<<TMPL
|
|
||||||
$comment DO NOT MODIFY. Generated by build task.
|
|
||||||
$comment Contribute here: https://www.transifex.com/projects/p/gridfieldbulkeditingtools/
|
|
||||||
|
|
||||||
TMPL;
|
|
||||||
|
|
||||||
return $banner;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the SilverStripe JS lang file template.
|
|
||||||
*
|
|
||||||
* @return string The JS file template
|
|
||||||
*/
|
|
||||||
private function getJSTemplate()
|
|
||||||
{
|
|
||||||
$tmpl = <<<TMPL
|
|
||||||
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
|
||||||
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
|
||||||
} else {
|
|
||||||
ss.i18n.addDictionary('%LOCALE%', %TRANSLATIONS%);
|
|
||||||
}
|
|
||||||
TMPL;
|
|
||||||
|
|
||||||
return $tmpl;
|
|
||||||
}
|
|
||||||
}
|
|
34
transifex.js
Normal file
34
transifex.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* Parse all source JS language files (JSON pulled from Transifex) from client/src/lang
|
||||||
|
* to SilverStripe i18n js file in client/lang
|
||||||
|
* Quick and dirty node script!
|
||||||
|
*/
|
||||||
|
var fs = require('fs');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
const PATHS = {
|
||||||
|
SRC: path.resolve('client/src/lang'),
|
||||||
|
DIST: path.resolve('client/lang'),
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('Writing SS i18n JS lang files...');
|
||||||
|
|
||||||
|
fs.readdir(PATHS.SRC, function(err, files)
|
||||||
|
{
|
||||||
|
files.forEach(function (file) {
|
||||||
|
var lang = file.split('.').shift();
|
||||||
|
fs.readFile(PATHS.SRC + '/' + file, "utf8", function(err, data) {
|
||||||
|
if (err) { console.log(err); }
|
||||||
|
var fileData = `if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
||||||
|
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
|
||||||
|
} else {
|
||||||
|
ss.i18n.addDictionary(${lang}, ${data});
|
||||||
|
}`;
|
||||||
|
|
||||||
|
fs.writeFile(PATHS.DIST + '/' + lang + '.js', fileData, "utf8", function(err) {
|
||||||
|
if (err) { console.log(err); }
|
||||||
|
console.log("Saved " + lang + '.js');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user