How do I apply Spanish to pivot?

Hi there, how can I apply other languages to the pivot so change labels and controls?

Hey @Mashiane, there is a way to change your locale globally across all of the Webix components that support it, and that is the setLocale() method, which allows you to switch locales between those found in the built-in locales. As you can see it does include Spanish as well.

Unfortunately, the pivot table/chart is only readily available in one language (English), meaning that you will have to add your localization manually. The best way to do so would be to add a new property to the specific locale (“es-ES” for Spanish in your case) in the webix.i18n.locales object (each property is responsible for a view and contains an object with labels corresponding to that view/property), which you’ll have to name pivot. Inside of that property you will have to pass in an object with your desired labels configration. It looks something like this:

webix.i18n.locales["es-ES"].pivot = {
  //your config ~ key: value ~ where key - original label, value - translated label
};

You can see all of the available pivot labels by looking up the webix.i18n.pivot object. If you’ve configured everything correctly, the setLocale() method will automatically apply the translated labels from your configuration to the pivot component.

Here is a small example of everything I’ve mentioned: https://snippet.webix.com/hfnhm4co.

In this example I’ve “translated” (changed text for the label really) for the “Click to config” button. Also please note that you will have to refresh the component to reflect the changes.

Thank you so much!

Hi @Mashiane,

By the way, if you succeed in translating all the Pivot labels to Spanish, you can share the translation with other Webix users by making a pull request to our Locales repository:

We would appreciate any contribution :slight_smile:

The full list of labels is also available in the documentation.

A small remark from my end as well, you actually don’t need to refresh the component if you set the locale before initializing the UI, my bad: https://snippet.webix.com/bm9ieh25.

Noted, I will ask the person I was trying to help code his way around it to provide. I wrote a library that i’m still testing out where we are coding in basic like syntax webix based webapps. Its going well, source code here, GitHub - Mashiane/BANanoWebix: An introductory port of the Webix web framework to use with BANano.