Set culture

Posted by: khauam.cardoso on 30 October 2025, 12:13 pm EST

  • Posted 30 October 2025, 12:13 pm EST

    When I use this function after open the workbook

    	CultureManager.culture('pt-BR');

    the language selector stops working for pt-br and only works for standard languages.

    https://www.loom.com/share/79562a3f15f545bdbf1f692e181f9a57

    Could you please make a demo showing how to open the spread in Portuguese (Brazil) and then get the selector working?

    spreadjs version 18.0.7

    angular 18.2.13

  • Posted 31 October 2025, 2:07 am EST

    Hi,

    You can refer to the following documentation for details on adding date formats for cultures other than “ja-jp”, “zh-cn”, or “en-us”:

    https://developer.mescius.com/spreadjs/docs/spreadjs-designer-component/customizations/designer-customize-culture

    Additionally, you can check the following forum discussions on the same topic:

    https://developer.mescius.com/forums/spreadjs/customize-culture

    https://developer.mescius.com/forums/spreadjs/how-to-add-more-date-time-format-in-spread-js

    I have also attached a sample that demonstrates how to add date formats for the Portuguese (Brazil) culture. You can refer to the attached sample for guidance.

    If you still face any issues, please share your sample or modify the attached one and send it back to us for review.

    Regards,

    Ankit

    angular.zip

  • Posted 31 October 2025, 8:02 am EST

    Good morning, I think I managed to replicate the case. I’m using this custom CultureInfo, and when I apply it, the design freezes.

    
     // Get the culture info instance
        const cultureInfo = new GC.Spread.Common.CultureInfo();
        cultureInfo.id = 0x0416;
        cultureInfo.predefinedFormats.Accounting = '_(R$* #,##0._);_(R$* (#,##0.);_(R$* "-"._);_(@_)';
        cultureInfo.displayName = 'Portuguese (Brazil)';
        cultureInfo.name = function () {
          return 'pt-BR';
        };
        cultureInfo.NumberFormat.currencyDecimalSeparator = ',';
        cultureInfo.NumberFormat.currencyGroupSeparator = '.';
        cultureInfo.NumberFormat.currencySymbol = 'R[/code];
        cultureInfo.NumberFormat.numberDecimalSeparator = ',';
        cultureInfo.NumberFormat.numberGroupSeparator = '.';
        cultureInfo.NumberFormat.listSeparator = ';';
        cultureInfo.NumberFormat.arrayListSeparator = '\\';
        cultureInfo.NumberFormat.arrayGroupSeparator = ';';
        cultureInfo.DateTimeFormat.abbreviatedDayNames = ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb'];
        cultureInfo.DateTimeFormat.abbreviatedMonthGenitiveNames = [
          'jan',
          'fev',
          'mar',
          'abr',
          'mai',
          'jun',
          'jul',
          'ago',
          'set',
          'out',
          'nov',
          'dez',
          '',
        ];
        cultureInfo.DateTimeFormat.abbreviatedMonthNames = ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez', ''];
        cultureInfo.DateTimeFormat.amDesignator = 'AM';
        cultureInfo.DateTimeFormat.dayNames = ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado'];
        cultureInfo.DateTimeFormat.fullDateTimePattern = "dddd, d 'de' MMMM 'de' yyyy HH:mm:ss";
        cultureInfo.DateTimeFormat.longDatePattern = "dddd, d 'de' MMMM 'de' yyyy";
        cultureInfo.DateTimeFormat.longTimePattern = 'HH:mm:ss';
        cultureInfo.DateTimeFormat.monthDayPattern = "d 'de' MMMM";
        cultureInfo.DateTimeFormat.monthGenitiveNames = [
          'janeiro',
          'fevereiro',
          'março',
          'abril',
          'maio',
          'junho',
          'julho',
          'agosto',
          'setembro',
          'outubro',
          'novembro',
          'dezembro',
          '',
        ];
        cultureInfo.DateTimeFormat.monthNames = [
          'janeiro',
          'fevereiro',
          'março',
          'abril',
          'maio',
          'junho',
          'julho',
          'agosto',
          'setembro',
          'outubro',
          'novembro',
          'dezembro',
          '',
        ];
        
        cultureInfo.DateTimeFormat.pmDesignator = 'PM';
        cultureInfo.DateTimeFormat.shortDatePattern = 'dd/MM/yyyy';
        cultureInfo.DateTimeFormat.defaultDatePattern = 'dd/MM/yyyy';
        cultureInfo.DateTimeFormat.shortTimePattern = 'HH:mm';
        cultureInfo.DateTimeFormat.yearMonthPattern = "MMMM 'de' yyyy";
        
    
        // Add new culture info
        GC.Spread.Common.CultureManager.addCultureInfo(cultureInfo.name(), cultureInfo);
        GC.Spread.Common.CultureManager.culture(cultureInfo.name());
    
  • Posted 3 November 2025, 2:02 am EST

    Hi,

    We tried to reproduce the behavior on our end using the code snippet you provided and noticed some issues when running it. It seems the problem occurs because the predefined formats are not defined. After defining them, it worked as expected. You can refer to the attached sample: Sample.zip

    If you still encounter the issue, please share a minimal working sample along with the steps to reproduce it, or modify the existing sample to replicate the behavior. This will help us investigate the problem more accurately. Additionally, it would be helpful if you could share a GIF or video demonstrating the issue.

    Regards,

    Priyam

Need extra support?

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

Learn More

Forum Channels