-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update settings for all RTL languages.
- Loading branch information
Showing
4 changed files
with
46 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 0 additions & 70 deletions
70
Oqtane.Server/Infrastructure/Localization/PersianCulture.cs
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
Oqtane.Server/Infrastructure/Localization/RightToLeftCulture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Reflection; | ||
|
||
namespace Oqtane.Infrastructure | ||
{ | ||
public class RightToLeftCulture | ||
{ | ||
public static CultureInfo ResolveFormat(CultureInfo cultureInfo) | ||
{ | ||
SetNumberFormatInfo(cultureInfo.NumberFormat); | ||
SetCalenar(cultureInfo); | ||
|
||
return cultureInfo; | ||
} | ||
|
||
private static void SetCalenar(CultureInfo cultureInfo) | ||
{ | ||
var calendar = new RightToLeftCultureCalendar(); | ||
|
||
var fieldInfo = cultureInfo.GetType().GetField("_calendar", BindingFlags.NonPublic | BindingFlags.Instance); | ||
if (fieldInfo != null) | ||
{ | ||
fieldInfo.SetValue(cultureInfo, calendar); | ||
} | ||
|
||
var info = cultureInfo.DateTimeFormat.GetType().GetField("calendar", BindingFlags.NonPublic | BindingFlags.Instance); | ||
if (info != null) | ||
{ | ||
info.SetValue(cultureInfo.DateTimeFormat, calendar); | ||
} | ||
} | ||
|
||
public static void SetNumberFormatInfo(NumberFormatInfo persianNumberFormatInfo) | ||
{ | ||
persianNumberFormatInfo.NumberDecimalSeparator = "."; | ||
persianNumberFormatInfo.DigitSubstitution = DigitShapes.NativeNational; | ||
persianNumberFormatInfo.NumberNegativePattern = 0; | ||
persianNumberFormatInfo.NegativeSign = "-"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters