Globalizing Report
Our sample projects and report templates can help you learn the basics of working with our products.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.
Setting
Localization setup. Load the requested culture or localization resource before the report interface and formatted values are produced.
import { Viewer, Stimulsoft } from 'stimulsoft-reports-js-react/viewer';
function App() {
const [selectedCountry, setSelectedCountry] = useState('en-US');
const locFile = `Localizations/` + selectedCountry.substring(0, 2) + '.xml';
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile(locFile);
var report = new Stimulsoft.Report.StiReport();
report.loadFile('Reports/Globalization.mrt');
report.culture = selectedCountry;
return (
<div className='container'>
<div className='container-control'>
<label className='label-globalization'>Select Language</label>
<select
value={selectedCountry}
onChange={(e) => setSelectedCountry(e.target.value)}
className='select-globalization'
>
<option value='en-US'>English</option>
<option value='de-DE'>Deutsch</option>
<option value='pl-PL'>Polish</option>
</select>
</div>
<div>
<Viewer key={selectedCountry} report={report} />
</div>
</div>
);
}
export default App;Setting
report.culture controls culture-dependent formatting, while StiLocalization.setLocalizationFile changes the viewer interface language — together they globalize both the document and the UI.