Is there a way to add a new language to antv s2 library?

52 views Asked by At

I am using antv s2 library in my application which handle french and english languages. Antv S2 only have Chineese and English languages natively. Is there a way to add a new one?

I don't see anything about it in the Internationalization doc. When trying to extended internationalization I can only add keys to english and chineese languages.

1

There are 1 answers

2
Lin Du On

You can use extendLocale function to extend the internationalized text.

import { PivotSheet, setLang, extendLocale, i18n, getLang } from "@antv/s2";

extendLocale({
    jp: {
        小计: "小計",
        总计: "合計",
        总和: "集合体",
        项: "項",
        已选择: "厳選された",
        //...
    },
});
setLang("jp");
console.log(i18n("已选择"), getLang()); // 厳選された jp