Serenity icon indicating copy to clipboard operation
Serenity copied to clipboard

DecimalEditor has problem by rtl

Open haajit opened this issue 2 years ago • 5 comments

The decimal editor does not allow entering numbers larger than three digits when the page is right to left

haajit avatar Jul 13 '22 14:07 haajit

#6450 Before that, please check System.Globalization.CultureInfo.CurrentUICulture in backend Q,Culture in browser console

Fill all new issue requirements which you deleted when creating an issue.

Here is same form:

PLEASE ENSURE ABOUT ALL FIELDS FILLED

  • [ ] This isn't a feature request or a discussion topic
  • [ ] I have searched open and closed issues for duplicates
  • [ ] I am searched documents on https://serenity.is/docs/
  • [ ] I have read https://serenity.is/docs/startsharp/faq
  • [ ] I have to use descriptive issue title
  • [ ] I approve to fill in the information below

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

**Serenity Versions

  • Serene Template Version (when reproduced on Serene Template)
  • Sergen Version (if required)
  • Installed Serenity Nuget Packages Versions (you can find them in csproj)

**Development Environment

  • Visual Studio Version:
  • Nodejs Version:
  • Typescript Version:
  • Database:
  • Database Version:

Desktop (please complete the following information):

  • OS: [e.g. Windows, Linux, Mac]
  • Browser [e.g. chrome, safari]
  • Browser Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Browser Version [e.g. 22]

Additional context Add any other context about the problem here.

VictorTomaili avatar Jul 13 '22 20:07 VictorTomaili

#6450 Before that, please check System.Globalization.CultureInfo.CurrentUICulture in backend Q,Culture in browser console my backend culture is fa-IR and Q.Culture information is : amDesignator: "AM" currencySymbol: "$" dateFormat: "yyyy/MM/dd" dateOrder: "ymd" dateSeparator: "/" dateTimeFormat: "yyyy/MM/dd HH:mm:ss" dayNames: (7) ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] decimalDigits: 2 decimalSeparator: "٫" firstDayOfWeek: 0 groupSeparator: "," groupSepearator: "٬" minimizedDayNames: (7) ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] monthNames: (13) ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', ''] negativeSign: "-" percentSymbol: "%" pmDesignator: "PM" positiveSign: "+" shortDayNames: (7) ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] shortMonthNames: (13) ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', ''] stringCompare: ƒ (a, b) timeSeparator: ":" [[Prototype]]: Object 

image

haajit avatar Jul 14 '22 06:07 haajit

I solved it in backend by this code: CultureInfo info = new CultureInfo("fa-IR"); CultureInfo info2 = new CultureInfo("en-US"); info.NumberFormat = info2.NumberFormat; System.Globalization.CultureInfo.CurrentCulture = info; but I think that it's not true way

haajit avatar Jul 14 '22 07:07 haajit

And what is your serenity versions, operation system, development enviroment versions example visual studio if you are use it, typescript etc. If there is some version or platform differences, we need to know it.

VictorTomaili avatar Jul 14 '22 08:07 VictorTomaili

Thank you for your time Serenity version : 5.1.1 Operation system : Windows 10 Pro Version 21H2 Visual Studio Enterprise 2019 : Version 16.11.3 TypeScript : 3.7.4

haajit avatar Jul 16 '22 04:07 haajit

in ~\Imports\ScriptCultureX.cs

change this code

public ScriptCultureX(CultureInfo culture)
       {
           var order = DateHelper.DateElementOrderFor(culture.DateTimeFormat.ShortDatePattern);
           DateOrder = DateHelper.DateOrderString(order);
           DateFormat = DateHelper.DefaultDateFormat(order);
           DateTimeFormat = DateHelper.DefaultDateTimeFormat(order);
           DateSeparator = DateTime.MaxValue.ToString("yy/MM/dd", culture.DateTimeFormat)[2].ToString();
//Here--------------------------------------------------------------------------------------------------
           DecimalSeparator = "."; //culture.NumberFormat.NumberDecimalSeparator;
           GroupSeparator = ","; // culture.NumberFormat.NumberGroupSeparator;
//Here--------------------------------------------------------------------------------------------------
       }

ageeb1982 avatar Nov 27 '22 05:11 ageeb1982