How to custom language

Posted by: 122368177 on 8 May 2020, 2:52 am EST

  • Posted 8 May 2020, 2:52 am EST

    Now I would like to custom ch-cn language .I import the @grapecity/spread-sheets-resources-zh,but it can’t meet my requirements.So, I hope it can extends the @grapecity/spread-sheets-resources-zh in order to change some names.

    Of course,I hope all the more I could get the source code

    Thanks

  • Posted 11 May 2020, 9:00 am EST

    Hi,

    To create a customer language, you need to define a localization object and add it to the culture manager. Please refer to the following code snippet and the demo sample which demonstrates the same

    var lang = {
      // localization config goes here
      Sheets = {
          Tip_Row: "行 = ",  //No parameters, will add the row number
          Tip_Column: "列 = ",
          Tip_Height: "高度: {0} 像素",   //Use the parameters
          Tip_Width: "寬度: {0} 像素",
      },
      CalcEngine: {
          Fbx_Summary: "概要"
      },
      Functions: {
          SUM: {
              description: "此函數返回某一單元格區域中所有數字之和。",
              parameters: ["值1", "值2"]
          },
          NOW: {
              description: "此函數返回當前的日期和時間。"
          },
          IF: {
              description: "使用邏輯函數 IF 函數時,如果條件為真,該函數將返回一個值;如果條件為假,函數將返回另一個值。",
              parameters: ["判断条件", "值1", "值2"]
          },
      }
    };
     GC.Spread.Common.CultureManager.addCultureInfo("zh-tw", null, lang); //Add the language
      GC.Spread.Common.CultureManager.culture("zh-tw"); //set the culture
    

    https://www.grapecity.com/spreadjs/demos/features/culture/custom-localization/purejs

    You may also refer to the following doc for more information: https://www.grapecity.com/spreadjs/docs/v13/online/CreatingandUsingaCustomLanguagePackage.html

    Regards

  • Posted 11 May 2020, 11:19 pm EST

    Hi,

    Thanks, How do I custom contextMenu language?

  • Posted 12 May 2020, 8:58 am EST

    For context Menu language you could provide the context Menu information in localization object please refer to the following code snippet and sample which demonstrates the same

    let lang = {
     // localization config for context Menu
        ContextMenu: {
          clearContents: "Inhalte löschen",
          copy: "Kopieren",
          cut: "Schnap",
          deleteColumns: "Löschen",
          deleteComment: "Kommentar löschen",
          deleteRows: "Löschen",
          deleteSheet: "Löschen",
          editComment: "Kommentar bearbeiten",
          filter: "Filter",
          hideColumns: "Verstecken",
          hideRows: "Verstecken",
          hideSheet: "Verstecken",
          insertColumns: "Einfügen",
          insertComment: "Kommentar einfügen",
          insertRows: "Einfügen",
          insertSheet: "Einfügen",
          pasteAll: "Alle",
          pasteFormatting: "Formatierung",
          pasteFormula: "Formeln",
          pasteFormulaFormatting: "Formel & Formatierung",
          pasteOptions: "Einfügeoptionen:",
          pasteValues: "Werte",
          pasteValuesFormatting: "Werte & Formatierung",
          removeFloatingObject: "Entfernen",
          removeSlicer: "Entfernen",
          slicerSortAscend: "Sortieren von A bis Z",
          slicerSortDescend: "Sortieren von Z nach A",
          sort: "Sortieren",
          sortAscend: "Sortieren von A bis Z",
          sortDescend: "Z nach A sortieren",
          toggleComment: "Kommentar anzeigen / verbergen",
          unhideColumns: "Einblenden",
          unhideRows: "Einblenden",
          unhideSheet: "Einblenden"
        }
      };
      GC.Spread.Common.CultureManager.addCultureInfo("zh-tw", null, lang); //Add the language
      GC.Spread.Common.CultureManager.culture("zh-tw");
    

    Sample: https://codesandbox.io/s/elated-tereshkova-5pl5x?file=/src/index.js

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels