We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Localization via Json File

Thread ID:

Created:

Updated:

Platform:

Replies:

144844 May 25,2019 02:23 AM UTC May 27,2019 10:35 AM UTC Angular - EJ 2 1
loading
Tags: Grid
Albert K
Asked On May 25, 2019 02:23 AM UTC


I would like to know if L10n can be stored as individual json file eg en_GB.json, de_DE.json file, instead of declaring everything in one json.  Thank you.


import { L10n, setCulture } from '@syncfusion/ej2-base';
import { Component, OnInit } from '@angular/core';
import { data } from './datasource';
import {PageSettingsModel } from '@syncfusion/ej2-angular-grids';

setCulture('de-DE');

L10n.load({
    'de-DE': {
        'grid': {
            'EmptyRecord': 'Keine Aufzeichnungen angezeigt',
            'GroupDropArea': 'Ziehen Sie einen Spaltenkopf hier, um die Gruppe ihre Spalte',
            'UnGroup': 'Klicken Sie hier, um die Gruppierung aufheben',
            'EmptyDataSourceError': 'DataSource darf bei der Erstauslastung nicht leer sein, da Spalten aus der dataSource im AutoGenerate Spaltenraster',
            'Item': 'Artikel',
            'Items': 'Artikel'
        },
        'pager':{
            'currentPageInfo': '{0} von {1} Seiten',
            'totalItemsInfo': '({0} Beiträge)',
            'firstPageTooltip': 'Zur ersten Seite',
            'lastPageTooltip': 'Zur letzten Seite',
            'nextPageTooltip': 'Zur nächsten Seite',
            'previousPageTooltip': 'Zurück zur letzten Seit',
            'nextPagerTooltip': 'Zum nächsten Pager',
            'previousPagerTooltip': 'Zum vorherigen Pager'
        }
    }
});

Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 27, 2019 10:35 AM UTC

Hi Albert, 

Greetings from Syncfusion support. 

Yes, we can load as json file. Please refer the below code example. 

[app.component.ts] 
 
import { Component, OnInit } from '@angular/core'; 
import { loadCldr, L10n, setCulture } from '@syncfusion/ej2-base'; 
import { orderDetails } from './data'; 
import * as pt from './pt.json'; 
 
loadCldr(pt.default); 
setCulture('pt'); 
L10n.load(pt.default); 
 
@Component({ 
    selector: 'app-root', 
    templateUrl: 'app.component.html' 
}) 
export class AppComponent { 
    public data: Object[] = []; 
 
    ngOnInit(): void { 
        this.data = orderDetails; 
    } 
} 

--------------------------------------------------------------------------------------------------------------------------- 
[pt.json] 

{ 
   "pt":{ 
        "grid": { 
            "EmptyRecord": "Keine Aufzeichnungen angezeigt", 
            "GroupDropArea": "Ziehen Sie einen Spaltenkopf hier, um die Gruppe ihre Spalte", 
            "UnGroup": "Klicken Sie hier, um die Gruppierung aufheben", 
"EmptyDataSourceError": "DataSource darf bei der Erstauslastung nicht leer sein, da Spalten aus der dataSource im AutoGenerate Spaltenraster", 
            "Item": "Artikel", 
            "Items": "Artikel" 
        }, 
        "pager": { 
            "currentPageInfo": "{0} von {1} Seiten", 
            "totalItemsInfo": "({0} Beiträge)", 
            "firstPageTooltip": "Zur ersten Seite", 
            "lastPageTooltip": "Zur letzten Seite", 
            "nextPageTooltip": "Zur nächsten Seite", 
            "previousPageTooltip": "Zurück zur letzten Seit", 
            "nextPagerTooltip": "Zum nächsten Pager", 
            "previousPagerTooltip": "Zum vorherigen Pager" 
        } 
   } 
} 


We have prepared a simple sample in the following stackblitz link: 


Please let us know if you need further assistance on this. 

Regards, 
Thavasianand S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon