Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Update translations #359

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[main]
host = https://www.transifex.com

[o:silverstripe:p:silverstripe-gridfieldextensions:r:master]
file_filter = lang/<lang>.yml
source_file = lang/en.yml
source_lang = en
type = YML

[o:silverstripe:p:silverstripe-gridfieldextensions:r:master-js]
file_filter = client/lang/src/<lang>.json
source_file = client/lang/src/en.json
source_lang = en
type = KEYVALUEJSON

14 changes: 14 additions & 0 deletions client/lang/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file was generated by silverstripe/tx-translator from client/lang/src/en.json.
// See https://github.com/silverstripe/silverstripe-tx-translator for details
if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') {
if (typeof(console) !== 'undefined') { // eslint-disable-line no-console
console.error('Class ss.i18n not defined'); // eslint-disable-line no-console
}
} else {
ss.i18n.addDictionary('en', {
"GridFieldExtensions.CONFIRMDEL": "Are you sure you want to delete this?",
"GridFieldExtensions.ADD_CLASS": "Add: <i>{classname}</i>",
"GridFieldExtensions.OPEN_SEARCH_FILTER": "Open search and filter",
"GridFieldExtensions.SAVE_PUBLISH": "Save & publish"
});
}
6 changes: 6 additions & 0 deletions client/lang/src/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"GridFieldExtensions.CONFIRMDEL": "Are you sure you want to delete this?",
"GridFieldExtensions.ADD_CLASS": "Add: <i>{classname}</i>",
"GridFieldExtensions.OPEN_SEARCH_FILTER": "Open search and filter",
"GridFieldExtensions.SAVE_PUBLISH": "Save & publish"
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
],
"expose": [
"css",
"javascript"
"javascript",
"client/lang"
]
},
"replace": {
Expand Down
11 changes: 8 additions & 3 deletions javascript/GridFieldExtensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@
const classes = this.data('classes');
const liHtml = Object.keys(classes).map(className => {
const link = hrefTemplate.replace('{class}', className);
return `<li><a href="${link}">Add: <i>${classes[className]}</i></a></li>`;
const linkText = ss.i18n.inject(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're changing this then shouldn't there be an updated bundle.js too?

Copy link
Collaborator Author

@GuySartorelli GuySartorelli Mar 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? This is just making strings translatable. It doesn't affect how (or even if) it's transpiled.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll if there was a bundle.js we'd need to update it so that translations were actually used :-)

It's a non issue though

Requirements::javascript('symbiote/silverstripe-gridfieldextensions:javascript/GridFieldExtensions.js');

ss.i18n._t('GridFieldExtensions.ADD_CLASS', 'Add: <i>{classname}</i>'),
{classname: classes[className]}
);
return `<li><a href="${link}">${linkText}</a></li>`;
});

const listElement = $(`<ul class="grid-field-inline-new--multi-class-list">${liHtml.join('')}</ul>`);
Expand Down Expand Up @@ -336,7 +340,8 @@
content = '<span class="non-sortable"></span>';
self.addClass('show-filter').find('.grid-field__filter-header').show();
} else {
content = '<button type="button" title="Open search and filter" name="showFilter" class="btn btn-secondary font-icon-search btn--no-text btn--icon-large grid-field__filter-open"></button>';
const contentTitle = ss.i18n._t('GridFieldExtensions.OPEN_SEARCH_FILTER', 'Open search and filter');
content = `<button type="button" title="${contentTitle}" name="showFilter" class="btn btn-secondary font-icon-search btn--no-text btn--icon-large grid-field__filter-open"></button>`;
self.removeClass('show-filter').find('.grid-field__filter-header').hide();
}

Expand Down Expand Up @@ -364,7 +369,7 @@
publish.removeClass('font-icon-tick');
publish.addClass('btn-primary');
publish.addClass('font-icon-rocket');
publish.find('.btn__title').html('Save & publish');
publish.find('.btn__title').html(ss.i18n._t('GridFieldExtensions.SAVE_PUBLISH', 'Save & publish'));
}
},
error: function (e) {
Expand Down
6 changes: 3 additions & 3 deletions lang/de_DE.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
de_DE:
GridFieldAddExistingSearchHandler.ss:
NOITEMS: 'Kein Ergebnis'
RESULTS: 'Ergebnisse'
RESULTS: Ergebnisse
GridFieldExtensions:
ADD: 'Hinzufügen'
ADD: Hinzufügen
ADDEXISTING: 'Bestehenden Eintrag hinzufügen'
SEARCH: 'Suche'
SEARCH: Suche
SELECTTYPETOCREATE: '(Bitte Typ auswählen)'
2 changes: 2 additions & 0 deletions lang/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ en:
RESULTS: Results
SEARCH: Search
SELECTTYPETOCREATE: '(Select type to create)'
Symbiote\GridFieldExtensions\Extensions\GridFieldDetailFormItemRequestExtension:
NEW: 'Add new record'
Symbiote\GridFieldExtensions\GridFieldConfigurablePaginator:
SHOW: Show
6 changes: 3 additions & 3 deletions lang/es_ES.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
es_ES:
GridFieldAddExistingSearchHandler.ss:
NOITEMS: 'No hay items.'
RESULTS: 'Resultados'
RESULTS: Resultados
GridFieldExtensions:
ADD: 'Agregar'
ADD: Agregar
ADDEXISTING: 'Agregar existente'
SEARCH: 'Buscar'
SEARCH: Buscar
SELECTTYPETOCREATE: '(Seleccionar tipo para crear)'
2 changes: 1 addition & 1 deletion lang/et_EE.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
et_EE:
GridFieldAddExistingSearchHandler.ss:
NOITEMS: 'Kirjed puuduvad.'
RESULTS: 'Tulemused'
RESULTS: Tulemused
GridFieldExtensions:
ADD: Lisa
ADDEXISTING: 'Lisa olemasolev'
Expand Down
6 changes: 3 additions & 3 deletions lang/fi_FI.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fi_FI:
GridFieldAddExistingSearchHandler.ss:
NOITEMS: 'Ei kohteita'
RESULTS: 'Tulokset'
RESULTS: Tulokset
GridFieldExtensions:
ADD: 'Lisää'
ADD: Lisää
ADDEXISTING: 'Lisää olemassa oleva'
SEARCH: 'Etsi'
SEARCH: Etsi
SELECTTYPETOCREATE: 'Valitse lisättävä tyyppi'
6 changes: 3 additions & 3 deletions lang/it_IT.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
it_IT:
GridFieldAddExistingSearchHandler.ss:
NOITEMS: 'Nessun elemento.'
RESULTS: 'Risultati'
RESULTS: Risultati
GridFieldExtensions:
ADD: 'Aggiungi'
ADD: Aggiungi
ADDEXISTING: 'Aggiungi esistente'
SEARCH: 'Cerca'
SEARCH: Cerca
SELECTTYPETOCREATE: '(Seleziona tipo per creare)'
6 changes: 3 additions & 3 deletions lang/nl_NL.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
nl_NL:
GridFieldAddExistingSearchHandler.ss:
NOITEMS: 'Geen resultaten gevonden.'
RESULTS: 'Resultaten'
RESULTS: Resultaten
GridFieldExtensions:
ADD: 'Toevoegen'
ADD: Toevoegen
ADDEXISTING: 'Bestaande toevoegen'
SEARCH: 'Zoeken'
SEARCH: Zoeken
SELECTTYPETOCREATE: '(Selecteer type om te creeën)'
6 changes: 3 additions & 3 deletions lang/ru_RU.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ru_RU:
GridFieldAddExistingSearchHandler.ss:
NOITEMS: 'Нет элементов.'
RESULTS: 'Результаты'
RESULTS: Результаты
GridFieldExtensions:
ADD: 'Добавить'
ADD: Добавить
ADDEXISTING: 'Добавить существующий'
SEARCH: 'Поиск'
SEARCH: Поиск
SELECTTYPETOCREATE: '(Выберите тип для создания)'
4 changes: 2 additions & 2 deletions lang/sk.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
sk:
GridFieldAddExistingSearchHandler.ss:
NOITEMS: 'Nie sú tu žiadne položky.'
RESULTS: 'Výsledky'
RESULTS: Výsledky
GridFieldExtensions:
ADD: Pridať
ADDEXISTING: Pridať existujúci
ADDEXISTING: 'Pridať existujúci'
SEARCH: Hľadať
SELECTTYPETOCREATE: '(Prosím, vyberte typ)'