Open Closed

Decimal Separator in Arabic language gives validation error #7708


User avatar
0
nabass created
  • ABP Framework version: v8.0.2
  • UI Type: MVC
  • Database System: EF Core (SQL Server )
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
  • i would like to ask about when i change language in abp application in at runtime to arabic gets error of my entity
  • because decimal field has comma separator ? any advice to make common solution
  • the following image clarify the error and display in English like "The field should be numeric from 0 to 99999"

7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you check this first? https://abp.io/support/questions/4102/error-in-fraction-point-in-arabic-language

  • User Avatar
    0
    nabass created

    Thank you for quickly response : and it is working with me after but this line System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; in webModule but there is another error because i use this line in my services var cultureName = CultureInfo.CurrentCulture.Name; and check if cultureName =='ar' do somthing, but now this variable cultureName gives me empty string , could you please advice .

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share some of your code.

  • User Avatar
    0
    nabass created

    this sample of code to get data according to selected culture //====================================================== var cultureName= CultureInfo.CurrentCulture.Name; var dbContext = await GetDbContextAsync();

    var result = (await GetDbSetAsync()) .Join(dbContext.Set<JournalVoucherStatusCulture>(), journalStatus => journalStatus.Id, journalStatusCulture => journalStatusCulture.VoucherStatusId, (journalStatus, journalStatusCulture) => new { journalStatus, journalStatusCulture }) .Where(a => a.journalStatus.JournalStatusTitle.Contains(fiscalYearStatusTitle) && a.journalStatusCulture.CultureId == cultureName) .Select(x => new JournalStatusCul { Id = x.journalStatus.Id, JournalStatusTitle = x.journalStatusCulture.JournalStatusTitle != null ? x.journalStatusCulture.JournalStatusTitle : x.journalStatus.JournalStatusTitle });

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try this?

    app.Use(async (httpContext, next) =>
    {
        if (System.Threading.Thread.CurrentThread.CurrentCulture.Name == "ar")
        {
            using (CultureHelper.Use(System.Globalization.CultureInfo.InvariantCulture, System.Globalization.CultureInfo.InvariantCulture))
            {
                await next(httpContext);
            }
        }
        else
        {
            await next(httpContext);
        }
    });
    
  • User Avatar
    0
    nabass created

    I write the code which you sent as but after that when i change language from UI in the application doesn't change layout to RTL

    nothing change in Layout still menu at left side

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I see.

    Can you try these two solutions?

    1.

    http://blog.rebuildall.net/2011/03/02/jQuery_validate_and_the_comma_decimal_separator

    2.

    https://github.com/dotnet/aspnetcore/issues/6566#issuecomment-1213584906

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09