Skip to content

Commit acb7e53

Browse files
Fix error with calendar in Arabic culture.
1 parent 2625f1e commit acb7e53

File tree

7 files changed

+64
-11
lines changed

7 files changed

+64
-11
lines changed

dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2715,7 +2715,7 @@ public DateTime YMDToD(int year, int month, int day)
27152715
{
27162716
try
27172717
{
2718-
return new DateTime(fourDigitsYear, month, day, cultureInfo.Calendar);
2718+
return new DateTime(fourDigitsYear, month, day, cultureInfo.DateTimeFormat.Calendar);
27192719
}
27202720
catch
27212721
{
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using GeneXus.Application;
3+
using Xunit;
4+
namespace UnitTesting
5+
{
6+
public class LanguageCmdTest
7+
{
8+
9+
[Fact]
10+
11+
public void TestLangugae()
12+
{
13+
GxContext context = new GxContext();
14+
context.SetLanguage("Arabic");
15+
DateTime arabicDate = context.localUtil.YMDToD(2025, 4, 1);
16+
Assert.Equal(2025, arabicDate.Year);
17+
string msg = context.localUtil.Format(arabicDate, "99/99/99");
18+
Assert.Equal("01/04/25", msg);
19+
msg = context.GetMessage("hello", "");
20+
Assert.Equal("مرحبا", msg);
21+
}
22+
23+
}
24+
25+
}

dotnet/test/DotNetCoreCmdTest/DotNetCoreCmdTest.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
<None Update="appsettings.json">
3434
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3535
</None>
36+
<None Update="messages.arabic.resources">
37+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
38+
</None>
39+
<None Update="messages.eng.resources">
40+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
41+
</None>
42+
<None Update="messages.spa.resources">
43+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
44+
</None>
3645
</ItemGroup>
3746

3847

dotnet/test/DotNetCoreCmdTest/appsettings.json

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,33 @@
5151
"CORS_ALLOW_ORIGIN": "https://normal-website.com",
5252
"MY_CUSTOM_PTY": "DEFAULT_VALUE"
5353
},
54-
"languages": {
55-
"English": {
56-
"code": "eng",
57-
"culture": "en-US",
58-
"date_fmt": "MDY",
59-
"decimal_point": ".",
60-
"thousand_sep": ",",
61-
"time_fmt": "12"
62-
}
63-
}
54+
"languages": {
55+
"English": {
56+
"code": "eng",
57+
"culture": "en-US",
58+
"date_fmt": "MDY",
59+
"decimal_point": ".",
60+
"rtl": "false",
61+
"thousand_sep": ",",
62+
"time_fmt": "12"
63+
},
64+
"Spanish": {
65+
"code": "spa",
66+
"culture": "es-ES",
67+
"date_fmt": "DMY",
68+
"decimal_point": ",",
69+
"rtl": "false",
70+
"thousand_sep": ".",
71+
"time_fmt": "24"
72+
},
73+
"Arabic": {
74+
"code": "arabic",
75+
"culture": "ar-SA",
76+
"date_fmt": "DMY",
77+
"decimal_point": ",",
78+
"rtl": "true",
79+
"thousand_sep": ".",
80+
"time_fmt": "24"
81+
}
82+
}
6483
}
47.7 KB
Binary file not shown.
39.5 KB
Binary file not shown.
42 KB
Binary file not shown.

0 commit comments

Comments
 (0)