A report can be rendered for a specific culture, formatting numbers, dates and localized text accordingly.

Localization setup. Load the requested culture or localization resource before the report interface and formatted values are produced.
@Component({
    selector: 'globalizing-report',
    imports: [Viewer],
    template: `
        <div class="container">
            <div class="container-control">
                <label class="label-globalization">Select Language</label>
                <select (change)="update($event.target)" class="select-globalization">
                        <option [value]="'en-US'">English</option>
                        <option [value]="'de-DE'">Deutsch</option>
                        <option [value]="'pl-PL'">Polish</option>
                </select>
            </div>
            <div>
                <sti-viewer [report]="report" [options]="viewerOptions"></sti-viewer>
            </div>
        </div>`,
    styleUrls: ['../styles.css']
})
export class GlobalizingReport {
    report: Stimulsoft.Report.StiReport;
    viewerOptions: Stimulsoft.Viewer.StiViewerOptions;

    update(e: any) {
        var selectedCountry = e.value;
        const locFile = `Localizations/` + selectedCountry.substring(0, 2) + '.xml';
        Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile(locFile);

        this.viewerOptions = new Stimulsoft.Viewer.StiViewerOptions();

        this.report = new Stimulsoft.Report.StiReport();
        this.report.loadFile('Reports/Globalization.mrt');
        this.report.culture = selectedCountry;
    }

    constructor() {
        this.report = new Stimulsoft.Report.StiReport();
        this.viewerOptions = new Stimulsoft.Viewer.StiViewerOptions();

        this.update({ value: 'en-US' });
    }
}

Setting report.culture controls culture-dependent formatting, while StiLocalization.setLocalizationFile changes the viewer interface language — together they globalize both the document and the UI.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.