({...el, ...{title: filterTitles[el.name]}}));
}
},
+ watch: {
+ "language.value": {
+ handler(newSelectedLanguage) {
+ if (!this.$props.tabulatorOptions.locale) return;
+
+ this.tabulator.setLocale(newSelectedLanguage);
+
+ if (this.$props.tabulatorOptions.responsiveLayoutCollapseFormatter) {
+ this.localizeCollapsedColumnHeadings(newSelectedLanguage);
+ }
+ },
+ },
+ },
methods: {
reloadTable() {
if (this.tableOnly)
@@ -263,6 +278,11 @@ export const CoreFilterCmpt = {
persistence: this.persistence,
}, ...(this.tabulatorOptions || {})};
+ // set up localizations if required
+ if (tabulatorOptions.locale) {
+ tabulatorOptions = await this.configureTabulatorLocalizations(tabulatorOptions);
+ }
+
// set default height if no height property is set
if (tabulatorOptions.height === undefined &&
tabulatorOptions.minHeight === undefined &&
@@ -302,7 +322,13 @@ export const CoreFilterCmpt = {
for (let evt of this.tabulatorEvents)
this.tabulator.on(evt.event, evt.handler);
}
- this.tabulator.on('tableBuilt', () => {this.tableBuilt = true; this.$emit('tableBuilt');});
+ this.tabulator.on('tableBuilt', () => {
+ this.tableBuilt = true;
+ this.$emit('tableBuilt');
+ if (tabulatorOptions.locale && tabulatorOptions.responsiveLayoutCollapseFormatter) {
+ this.localizeCollapsedColumnHeadings();
+ }
+ });
this.tabulator.on("rowSelectionChanged", data => {
this.selectedData = data;
});
@@ -340,6 +366,9 @@ export const CoreFilterCmpt = {
this.selectedFields = cols.filter(col => col.isVisible()).map(col => col.getField());
if (this.tabulator.options.persistence.headerFilter)
this._setHeaderFilter();
+ if (tabulatorOptions.locale && tabulatorOptions.responsiveLayoutCollapseFormatter) {
+ this.localizeCollapsedColumnHeadings();
+ }
});
}
@@ -349,6 +378,134 @@ export const CoreFilterCmpt = {
this.$emit("headerFilterOn", this.filterActive);
});
},
+ async configureTabulatorLocalizations(tabulatorOptions) {
+ tabulatorOptions.locale = this.$p.user_language.value;
+ tabulatorOptions.langs = {};
+
+ let phrasesGroupedByCategoryRequestParam = {
+ tabulator: [
+ "loading",
+ "error",
+ "item",
+ "items",
+ "page_size",
+ "page_title",
+ "first",
+ "first_title",
+ "last",
+ "last_title",
+ "prev",
+ "prev_title",
+ "next",
+ "next_title",
+ "all",
+ "showing",
+ "of",
+ "rows",
+ "pages",
+ ],
+ };
+ tabulatorOptions.columns.forEach((column) => {
+ if (column.field === "collapse") return;
+
+ let [category, phrase] = column.title.split("/");
+ if (phrasesGroupedByCategoryRequestParam[category]) {
+ phrasesGroupedByCategoryRequestParam[category].push(phrase);
+ } else {
+ phrasesGroupedByCategoryRequestParam[category] = [phrase];
+ }
+ });
+
+ const phrasesResponse = await this.$api.call(
+ ApiPhrases.getPhrases(phrasesGroupedByCategoryRequestParam),
+ );
+ const phrasesData = phrasesResponse.data;
+
+ Object.keys(phrasesData).forEach((language) => {
+ let genericTabulatorPhrases = phrasesData[language].filter(
+ (phrase) => phrase.category === "tabulator",
+ );
+
+ let tabulatorPhraseToTranslationMapper = {};
+ genericTabulatorPhrases.forEach((phrase) => {
+ tabulatorPhraseToTranslationMapper[phrase.phrase] =
+ phrase.text;
+ });
+
+ tabulatorOptions.langs[language] = {
+ data: {
+ loading: tabulatorPhraseToTranslationMapper["loading"],
+ error: tabulatorPhraseToTranslationMapper["error"],
+ },
+ groups: {
+ item: tabulatorPhraseToTranslationMapper["item"],
+ items: tabulatorPhraseToTranslationMapper["items"],
+ },
+ pagination: {
+ page_size:
+ tabulatorPhraseToTranslationMapper["page_size"],
+ page_title:
+ tabulatorPhraseToTranslationMapper["page_title"],
+ first: tabulatorPhraseToTranslationMapper["first"],
+ first_title:
+ tabulatorPhraseToTranslationMapper["first_title"],
+ last: tabulatorPhraseToTranslationMapper["last"],
+ last_title:
+ tabulatorPhraseToTranslationMapper["last_title"],
+ prev: tabulatorPhraseToTranslationMapper["prev"],
+ prev_title:
+ tabulatorPhraseToTranslationMapper["prev_title"],
+ next: tabulatorPhraseToTranslationMapper["next"],
+ next_title:
+ tabulatorPhraseToTranslationMapper["next_title"],
+ all: tabulatorPhraseToTranslationMapper["all"],
+ counter: {
+ showing:
+ tabulatorPhraseToTranslationMapper["showing"],
+ of: tabulatorPhraseToTranslationMapper["of"],
+ rows: tabulatorPhraseToTranslationMapper["rows"],
+ pages: tabulatorPhraseToTranslationMapper["pages"],
+ },
+ },
+ };
+
+ let columnHeadingPhrases = phrasesData[language].filter(
+ (phrase) => phrase.category !== "tabulator",
+ );
+
+ let columnTitleToTranslationMapper = {};
+ columnHeadingPhrases.forEach((phrase) => {
+ columnTitleToTranslationMapper[
+ phrase.category + "/" + phrase.phrase
+ ] = phrase.text;
+ });
+
+ let columnFieldToTranslationMapper = {};
+ tabulatorOptions.columns.forEach((column) => {
+ if (column.field === "collapse") return;
+ columnFieldToTranslationMapper[column.field] =
+ columnTitleToTranslationMapper[column.title];
+ });
+
+ tabulatorOptions.langs[language].columns =
+ columnFieldToTranslationMapper;
+ });
+
+ return tabulatorOptions;
+ },
+ async localizeCollapsedColumnHeadings() {
+ const columnHeadings = this.tabulator.getLang().columns;
+
+ this.$refs.table
+ .querySelectorAll(".collapsedColumnHeading")
+ .forEach((collapsedColumnHeadingElement) => {
+ const field = collapsedColumnHeadingElement.getAttribute("field");
+ if (!field?.length) return;
+
+ collapsedColumnHeadingElement.innerHTML =
+ columnHeadings[field];
+ });
+ },
updateTabulator() {
if (this.tabulator) {
if (this.tableBuilt)
diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php
index 0476db2c9..fd3de09b8 100644
--- a/system/phrasesupdate.php
+++ b/system/phrasesupdate.php
@@ -58177,6 +58177,388 @@ I have been informed that I am under no obligation to consent to the transmissio
)
),
// ### Phrases Dashboard Admin END
+ // generic tabulator phrases START
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'loading',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Loading',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'error',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Error',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'item',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'item',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'items',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'items',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'page_size',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Page Size',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'page_title',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Show Page',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'first',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'First',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'first_title',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'First Page',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'last',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Last',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'last_title',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Last Page',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'prev',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Prev',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'prev_title',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Prev Page',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'next',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Next',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'next_title',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Next Page',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'all',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'All',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'showing',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'Showing',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'of',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'of',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'rows',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'rows',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ array(
+ 'app' => 'core',
+ 'category' => 'tabulator',
+ 'phrase' => 'pages',
+ 'insertvon' => 'system',
+ 'phrases' => array(
+ array(
+ 'sprache' => 'German',
+ 'text' => '???',
+ 'description' => '',
+ 'insertvon' => 'system'
+ ),
+ array(
+ 'sprache' => 'English',
+ 'text' => 'pages',
+ 'description' => '',
+ 'insertvon' => 'system'
+ )
+ )
+ ),
+ // generic tabulator phrases END
);