Localizing functions
You can localize a function’s ID and error messages. Currently, HyperFormula supports 18 languages, with British English as the default.
To change the language all you need to do is import and register the language like so:
// import the French language packimport frFR from 'hyperformula/i18n/languages/frFR';
// register the languageHyperFormula.registerLanguage('frFR', frFR);Then set it inside it the configuration options:
// configure the instanceconst options = { language: 'frFR'};Language pack names should be passed as strings. They follow a
naming convention that incorporates two standards: ISO-639 and
ISO-3166-1. The pattern is languageCOUNTRY, for
example enUS, enGB, frFR, etc.
You can freely use the localized names: SUM can be written as
SOMME and the functionality of the function will remain the same.
Here are some example functions and their translations in French:
// localized functionsfunctions: { MATCH: 'EQUIV', CORREL: 'COEFFICIENT.CORRELATION', AVERAGE: 'MOYENNE'},Same goes for the errors displayed inside cells when something goes wrong:
// localized errorserrors: { CYCLE: '#CYCLE!', DIV_BY_ZERO: '#DIV/0!', ERROR: '#ERROR!', NA: '#N/A', NAME: '#NOM?', NUM: '#NOMBRE!', REF: '#REF!', VALUE: '#VALEUR!',}Creating a custom language pack
Section titled “Creating a custom language pack”If your desired language is not in the list of supported languages, you can create a custom language pack:
// Create a language pack objectconst spanish = { errors: { NAME: '#¿NOMBRE?', // ... }, functions: { SUM: 'SUMA', IF: 'SI', // ... }, langCode: 'es', // Your custom language code ui: { NEW_SHEET_PREFIX: 'Sheet', },};
// Register your languageHyperFormula.registerLanguage('es', spanish);
// Use it in your configurationconst hf = HyperFormula.buildEmpty({ licenseKey: 'gpl-v3', language: 'es'});Localizing custom functions
Section titled “Localizing custom functions”You can localize your custom functions as well. For details, see the Custom functions guide.
List of supported languages
Section titled “List of supported languages”| Language name | Language code |
|---|---|
| British English | enGB |
| American English | enUS |
| Czech | csCZ |
| Danish | daDK |
| Dutch | nlNL |
| Finnish | fiFI |
| French | frFR |
| German | deDE |
| Hungarian | huHU |
| Italian | itIT |
| Norwegian | nbNO |
| Polish | plPL |
| Portuguese | ptPT |
| Russian | ruRU |
| Spanish | esES |
| Swedish | svSE |
| Turkish | trTR |
| Indonesian | idID |
| Name | Year_1 | Year_2 | Average | Sum |
|---|