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.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.