WIP: Arabic localization.|

This commit is contained in:
a.bouhuolia
2021-06-10 12:51:00 +02:00
parent 4fc7c37260
commit 1ea32884c2
465 changed files with 3299 additions and 2109 deletions

View File

@@ -0,0 +1,29 @@
import HasTenancyService from 'services/Tenancy/TenancyService';
import { Service, Inject } from 'typedi';
@Service()
export default class I18nService {
@Inject()
tenancy: HasTenancyService;
/**
* Mappes array collection to i18n localization based in given attributes.
* @param {Array<any>} data - Array collection.
* @param {string[]} attributes - Attributes.
* @param {number} tenantId - Tenant id.
*/
public i18nMapper(
data: Array<any>,
attributes: string[] = [],
tenantId: number
) {
const i18n = this.tenancy.i18n(tenantId);
return data.map((_data) => {
return {
label: i18n.__(_data.label),
..._data,
};
});
}
}