Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect time patterns for some cultures on browser in HybridGlobalization #103804

Merged
merged 6 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace System.Globalization
{
internal sealed partial class CultureData
{
private const int CULTURE_INFO_BUFFER_LEN = 50;
private const int CULTURE_INFO_BUFFER_LEN = 60;
private const int LOCALE_INFO_BUFFER_LEN = 80;

private void JSInitLocaleInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ public static IEnumerable<object[]> FullDateTimePattern_Get_TestData_HybridGloba
{
yield return new object[] { new CultureInfo("ar-SA").DateTimeFormat, "dddd، d MMMM yyyy h:mm:ss tt" }; // dddd، d MMMM yyyy g h:mm:ss tt
yield return new object[] { new CultureInfo("am-ET").DateTimeFormat, "yyyy MMMM d, dddd h:mm:ss tt" };
yield return new object[] { new CultureInfo("bg-BG").DateTimeFormat, PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS ? "dddd, d MMMM yyyy г. H:mm:ss ч." : "dddd, d MMMM yyyy г. H:mm:ss" }; // dddd, d MMMM yyyy 'г'. H:mm:ss
yield return new object[] { new CultureInfo("bg-BG").DateTimeFormat, PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS ? "dddd, d MMMM yyyy 'г'. H:mm:ss ч." : "dddd, d MMMM yyyy 'г'. H:mm:ss" }; // dddd, d MMMM yyyy 'г'. H:mm:ss
yield return new object[] { new CultureInfo("bn-BD").DateTimeFormat, "dddd, d MMMM, yyyy h:mm:ss tt" };
yield return new object[] { new CultureInfo("bn-IN").DateTimeFormat, "dddd, d MMMM, yyyy h:mm:ss tt" };
string catalanPattern = PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS ? "dddd, d de MMMM de yyyy H:mm:ss" : "dddd, d de MMMM del yyyy H:mm:ss";
yield return new object[] { new CultureInfo("ca-AD").DateTimeFormat, catalanPattern }; // dddd, d MMMM 'de' yyyy H:mm:ss
yield return new object[] { new CultureInfo("ca-ES").DateTimeFormat, catalanPattern }; // dddd, d MMMM 'de' yyyy H:mm:ss
string catalanPattern = PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS ? "dddd, d 'de' MMMM 'de' yyyy H:mm:ss" : "dddd, d 'de' MMMM 'del' yyyy H:mm:ss"; // dddd, d MMMM 'de' yyyy H:mm:ss
yield return new object[] { new CultureInfo("ca-AD").DateTimeFormat, catalanPattern };
yield return new object[] { new CultureInfo("ca-ES").DateTimeFormat, catalanPattern };
yield return new object[] { new CultureInfo("cs-CZ").DateTimeFormat, "dddd d. MMMM yyyy H:mm:ss" };
yield return new object[] { new CultureInfo("da-DK").DateTimeFormat, "dddd den d. MMMM yyyy HH.mm.ss" }; // dddd 'den' d. MMMM yyyy HH.mm.ss
yield return new object[] { new CultureInfo("da-DK").DateTimeFormat, "dddd 'den' d. MMMM yyyy HH.mm.ss" };
yield return new object[] { new CultureInfo("de-AT").DateTimeFormat, "dddd, d. MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("de-BE").DateTimeFormat, "dddd, d. MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("de-CH").DateTimeFormat, "dddd, d. MMMM yyyy HH:mm:ss" };
Expand Down Expand Up @@ -147,16 +147,16 @@ public static IEnumerable<object[]> FullDateTimePattern_Get_TestData_HybridGloba
yield return new object[] { new CultureInfo("en-ZA").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; // dddd, dd MMMM yyyy HH:mm:ss
yield return new object[] { new CultureInfo("en-ZM").DateTimeFormat, "dddd, d MMMM yyyy h:mm:ss tt" };
yield return new object[] { new CultureInfo("en-ZW").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; // dddd, dd MMMM yyyy HH:mm:ss
string latinAmericaSpanishFormat = PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS ? "dddd, d de MMMM de yyyy HH:mm:ss" : "dddd, d de MMMM de yyyy h:mm:ss tt"; // dddd, d 'de' MMMM 'de' yyyy HH:mm:ss
string latinAmericaSpanishFormat = PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS ? "dddd, d 'de' MMMM 'de' yyyy HH:mm:ss" : "dddd, d 'de' MMMM 'de' yyyy h:mm:ss tt"; // dddd, d 'de' MMMM 'de' yyyy HH:mm:ss
yield return new object[] { new CultureInfo("es-419").DateTimeFormat, latinAmericaSpanishFormat };
yield return new object[] { new CultureInfo("es-ES").DateTimeFormat, "dddd, d de MMMM de yyyy H:mm:ss" }; // dddd, d 'de' MMMM 'de' yyyy H:mm:ss
yield return new object[] { new CultureInfo("es-ES").DateTimeFormat, "dddd, d 'de' MMMM 'de' yyyy H:mm:ss" };
yield return new object[] { new CultureInfo("es-MX").DateTimeFormat, latinAmericaSpanishFormat };
yield return new object[] { new CultureInfo("et-EE").DateTimeFormat, "dddd, d. MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("fa-IR").DateTimeFormat, "yyyy MMMM d, dddd H:mm:ss" };
yield return new object[] { new CultureInfo("fi-FI").DateTimeFormat, "dddd d. MMMM yyyy H.mm.ss" };
yield return new object[] { new CultureInfo("fil-PH").DateTimeFormat, "dddd, MMMM d, yyyy h:mm:ss tt" };
yield return new object[] { new CultureInfo("fr-BE").DateTimeFormat, "dddd d MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("fr-CA").DateTimeFormat, "dddd d MMMM yyyy HH h mm min ss s" }; // dddd d MMMM yyyy HH 'h' mm 'min' ss 's'
yield return new object[] { new CultureInfo("fr-CA").DateTimeFormat, "dddd d MMMM yyyy HH 'h' mm 'min' ss 's'" };
yield return new object[] { new CultureInfo("fr-CH").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("fr-FR").DateTimeFormat, "dddd d MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("gu-IN").DateTimeFormat, "dddd, d MMMM, yyyy hh:mm:ss tt" };
Expand All @@ -171,8 +171,8 @@ public static IEnumerable<object[]> FullDateTimePattern_Get_TestData_HybridGloba
yield return new object[] { new CultureInfo("ja-JP").DateTimeFormat, "yyyy年M月d日dddd H:mm:ss" };
yield return new object[] { new CultureInfo("kn-IN").DateTimeFormat, "dddd, MMMM d, yyyy hh:mm:ss tt" };
yield return new object[] { new CultureInfo("ko-KR").DateTimeFormat, "yyyy년 M월 d일 dddd tt h:mm:ss" };
yield return new object[] { new CultureInfo("lt-LT").DateTimeFormat, "yyyy m. MMMM d d., dddd HH:mm:ss" }; // yyyy 'm'. MMMM d 'd'., dddd HH:mm:ss
yield return new object[] { new CultureInfo("lv-LV").DateTimeFormat, "dddd, yyyy. gada d. MMMM HH:mm:ss" }; // dddd, yyyy. 'gada' d. MMMM HH:mm:ss
yield return new object[] { new CultureInfo("lt-LT").DateTimeFormat, "yyyy 'm'. MMMM d 'd'., dddd HH:mm:ss" };
yield return new object[] { new CultureInfo("lv-LV").DateTimeFormat, "dddd, yyyy. 'gada' d. MMMM HH:mm:ss" };
yield return new object[] { new CultureInfo("ml-IN").DateTimeFormat, "yyyy, MMMM d, dddd h:mm:ss tt" };
yield return new object[] { new CultureInfo("mr-IN").DateTimeFormat, "dddd, d MMMM, yyyy h:mm:ss tt" };
yield return new object[] { new CultureInfo("ms-BN").DateTimeFormat, "dddd, d MMMM yyyy h:mm:ss tt" }; // dd MMMM yyyy h:mm:ss tt
Expand All @@ -184,10 +184,10 @@ public static IEnumerable<object[]> FullDateTimePattern_Get_TestData_HybridGloba
yield return new object[] { new CultureInfo("nl-BE").DateTimeFormat, "dddd d MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("nl-NL").DateTimeFormat, "dddd d MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("pl-PL").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("pt-BR").DateTimeFormat, "dddd, d de MMMM de yyyy HH:mm:ss" }; // dddd, d 'de' MMMM 'de' yyyy HH:mm:ss
yield return new object[] { new CultureInfo("pt-PT").DateTimeFormat, "dddd, d de MMMM de yyyy HH:mm:ss" }; // dddd, d 'de' MMMM 'de' yyyy HH:mm:ss
yield return new object[] { new CultureInfo("pt-BR").DateTimeFormat, "dddd, d 'de' MMMM 'de' yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("pt-PT").DateTimeFormat, "dddd, d 'de' MMMM 'de' yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("ro-RO").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("ru-RU").DateTimeFormat, "dddd, d MMMM yyyy г. HH:mm:ss" }; // dddd, d MMMM yyyy 'г'. HH:mm:ss
yield return new object[] { new CultureInfo("ru-RU").DateTimeFormat, "dddd, d MMMM yyyy 'г'. HH:mm:ss" };
yield return new object[] { new CultureInfo("sk-SK").DateTimeFormat, "dddd d. MMMM yyyy H:mm:ss" };
yield return new object[] { new CultureInfo("sl-SI").DateTimeFormat, "dddd, d. MMMM yyyy HH:mm:ss" }; // dddd, dd. MMMM yyyy HH:mm:ss
yield return new object[] { new CultureInfo("sr-Cyrl-RS").DateTimeFormat, "dddd, d. MMMM yyyy. HH:mm:ss" }; // dddd, dd. MMMM yyyy. HH:mm:ss
Expand All @@ -206,7 +206,7 @@ public static IEnumerable<object[]> FullDateTimePattern_Get_TestData_HybridGloba
yield return new object[] { new CultureInfo("th-TH").DateTimeFormat, "ddddที่ d MMMM g yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("tr-CY").DateTimeFormat, "d MMMM yyyy dddd h:mm:ss tt" };
yield return new object[] { new CultureInfo("tr-TR").DateTimeFormat, "d MMMM yyyy dddd HH:mm:ss" };
yield return new object[] { new CultureInfo("uk-UA").DateTimeFormat, "dddd, d MMMM yyyy р. HH:mm:ss" }; // dddd, d MMMM yyyy 'р'. HH:mm:ss
yield return new object[] { new CultureInfo("uk-UA").DateTimeFormat, "dddd, d MMMM yyyy 'р'. HH:mm:ss" };
yield return new object[] { new CultureInfo("vi-VN").DateTimeFormat, "dddd, d MMMM, yyyy HH:mm:ss" };
yield return new object[] { new CultureInfo("zh-CN").DateTimeFormat, "yyyy年M月d日dddd HH:mm:ss" }; // yyyy年M月d日dddd tth:mm:ss
yield return new object[] { new CultureInfo("zh-Hans-HK").DateTimeFormat, "yyyy年M月d日dddd tth:mm:ss" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public static IEnumerable<object[]> LongDatePattern_Get_TestData_HybridGlobaliza
// see the comments on the right to check the non-Hybrid result, if it differs
yield return new object[] {"ar-SA", "dddd، d MMMM yyyy" }; // dddd، d MMMM yyyy g
yield return new object[] {"am-ET", "yyyy MMMM d, dddd" };
yield return new object[] {"bg-BG", "dddd, d MMMM yyyy г." }; // "dddd, d MMMM yyyy 'г'."
yield return new object[] {"bg-BG", "dddd, d MMMM yyyy 'г'." };
yield return new object[] {"bn-BD", "dddd, d MMMM, yyyy" };
yield return new object[] {"bn-IN", "dddd, d MMMM, yyyy" };
string catalanianPattern = PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS ? "dddd, d de MMMM de yyyy" : "dddd, d de MMMM del yyyy"; // "dddd, d MMMM 'de' yyyy"
string catalanianPattern = PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS ? "dddd, d 'de' MMMM 'de' yyyy" : "dddd, d 'de' MMMM 'del' yyyy"; // "dddd, d MMMM 'de' yyyy"
yield return new object[] {"ca-AD", catalanianPattern };
yield return new object[] {"ca-ES", catalanianPattern };
yield return new object[] {"cs-CZ", "dddd d. MMMM yyyy" };
yield return new object[] {"da-DK", "dddd den d. MMMM yyyy" }; // dddd 'den' d. MMMM yyyy
yield return new object[] {"da-DK", "dddd 'den' d. MMMM yyyy" };
yield return new object[] {"de-AT", "dddd, d. MMMM yyyy" };
yield return new object[] {"de-BE", "dddd, d. MMMM yyyy" };
yield return new object[] {"de-CH", "dddd, d. MMMM yyyy" };
Expand Down Expand Up @@ -150,9 +150,10 @@ public static IEnumerable<object[]> LongDatePattern_Get_TestData_HybridGlobaliza
yield return new object[] {"en-ZM", "dddd, d MMMM yyyy" };
yield return new object[] {"en-ZW", "dddd, d MMMM yyyy" }; // "dddd, dd MMMM yyyy"
yield return new object[] {"en-US", "dddd, MMMM d, yyyy" };
yield return new object[] {"es-419", "dddd, d de MMMM de yyyy" }; // dddd, d 'de' MMMM 'de' yyyy
yield return new object[] {"es-ES", "dddd, d de MMMM de yyyy" }; // dddd, d 'de' MMMM 'de' yyyy
yield return new object[] {"es-MX", "dddd, d de MMMM de yyyy" }; // dddd, d 'de' MMMM 'de' yyyy
string spanishPattern = "dddd, d 'de' MMMM 'de' yyyy";
yield return new object[] {"es-419", spanishPattern };
yield return new object[] {"es-ES", spanishPattern };
yield return new object[] {"es-MX", spanishPattern };
yield return new object[] {"et-EE", "dddd, d. MMMM yyyy" };
yield return new object[] {"fa-IR", "yyyy MMMM d, dddd" };
yield return new object[] {"fi-FI", "dddd d. MMMM yyyy" };
Expand All @@ -173,8 +174,8 @@ public static IEnumerable<object[]> LongDatePattern_Get_TestData_HybridGlobaliza
yield return new object[] {"ja-JP", "yyyy年M月d日dddd" };
yield return new object[] {"kn-IN", "dddd, MMMM d, yyyy" };
yield return new object[] {"ko-KR", "yyyy년 M월 d일 dddd" };
yield return new object[] {"lt-LT", "yyyy m. MMMM d d., dddd" }; // "yyyy 'm'. MMMM d 'd'., dddd"
yield return new object[] {"lv-LV", "dddd, yyyy. gada d. MMMM" }; // "dddd, yyyy. 'gada' d. MMMM"
yield return new object[] {"lt-LT", "yyyy 'm'. MMMM d 'd'., dddd" };
yield return new object[] {"lv-LV", "dddd, yyyy. 'gada' d. MMMM" };
yield return new object[] {"ml-IN", "yyyy, MMMM d, dddd" };
yield return new object[] {"mr-IN", "dddd, d MMMM, yyyy" };
yield return new object[] {"ms-BN", "dddd, d MMMM yyyy" }; // "dd MMMM yyyy"
Expand All @@ -186,10 +187,10 @@ public static IEnumerable<object[]> LongDatePattern_Get_TestData_HybridGlobaliza
yield return new object[] {"nl-BE", "dddd d MMMM yyyy" };
yield return new object[] {"nl-NL", "dddd d MMMM yyyy" };
yield return new object[] {"pl-PL", "dddd, d MMMM yyyy" };
yield return new object[] {"pt-BR", "dddd, d de MMMM de yyyy" }; // dddd, d 'de' MMMM 'de' yyyy
yield return new object[] {"pt-PT", "dddd, d de MMMM de yyyy" }; // dddd, d 'de' MMMM 'de' yyyy
yield return new object[] {"pt-BR", "dddd, d 'de' MMMM 'de' yyyy" };
yield return new object[] {"pt-PT", "dddd, d 'de' MMMM 'de' yyyy" };
yield return new object[] {"ro-RO", "dddd, d MMMM yyyy" };
yield return new object[] {"ru-RU", "dddd, d MMMM yyyy г." }; // "dddd, d MMMM yyyy 'г'."
yield return new object[] {"ru-RU", "dddd, d MMMM yyyy 'г'." };
yield return new object[] {"sk-SK", "dddd d. MMMM yyyy" };
yield return new object[] {"sl-SI", "dddd, d. MMMM yyyy" }; // "dddd, dd. MMMM yyyy"
yield return new object[] {"sr-Cyrl-RS", "dddd, d. MMMM yyyy." }; // "dddd, dd. MMMM yyyy"
Expand All @@ -208,7 +209,7 @@ public static IEnumerable<object[]> LongDatePattern_Get_TestData_HybridGlobaliza
yield return new object[] {"th-TH", "ddddที่ d MMMM g yyyy" };
yield return new object[] {"tr-CY", "d MMMM yyyy dddd" };
yield return new object[] {"tr-TR", "d MMMM yyyy dddd" };
yield return new object[] {"uk-UA", "dddd, d MMMM yyyy р." }; // "dddd, d MMMM yyyy 'р'."
yield return new object[] {"uk-UA", "dddd, d MMMM yyyy 'р'." };
yield return new object[] {"vi-VN", "dddd, d MMMM, yyyy" };
yield return new object[] {"zh-CN", "yyyy年M月d日dddd" };
yield return new object[] {"zh-Hans-HK", "yyyy年M月d日dddd" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static IEnumerable<object[]> LongTimePattern_Get_TestData_HybridGlobaliza
yield return new object[] { new CultureInfo("fi-FI").DateTimeFormat, "H.mm.ss" };
yield return new object[] { new CultureInfo("fil-PH").DateTimeFormat, "h:mm:ss tt" };
yield return new object[] { new CultureInfo("fr-BE").DateTimeFormat, "HH:mm:ss" };
yield return new object[] { new CultureInfo("fr-CA").DateTimeFormat, "HH h mm min ss s" }; // HH 'h' mm 'min' ss 's'
yield return new object[] { new CultureInfo("fr-CA").DateTimeFormat, "HH 'h' mm 'min' ss 's'" };
yield return new object[] { new CultureInfo("fr-CH").DateTimeFormat, "HH:mm:ss" };
yield return new object[] { new CultureInfo("fr-FR").DateTimeFormat, "HH:mm:ss" };
yield return new object[] { new CultureInfo("gu-IN").DateTimeFormat, "hh:mm:ss tt" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static IEnumerable<object[]> ShortTimePattern_Get_TestData_HybridGlobaliz
yield return new object[] { new CultureInfo("fi-FI").DateTimeFormat, "H.mm" };
yield return new object[] { new CultureInfo("fil-PH").DateTimeFormat, "h:mm tt" };
yield return new object[] { new CultureInfo("fr-BE").DateTimeFormat, "HH:mm" };
yield return new object[] { new CultureInfo("fr-CA").DateTimeFormat, "HH h mm min" }; // HH 'h' mm
yield return new object[] { new CultureInfo("fr-CA").DateTimeFormat, "HH 'h' mm 'min'" }; // HH 'h' mm
yield return new object[] { new CultureInfo("fr-CH").DateTimeFormat, "HH:mm" };
yield return new object[] { new CultureInfo("fr-FR").DateTimeFormat, "HH:mm" };
yield return new object[] { new CultureInfo("gu-IN").DateTimeFormat, "hh:mm tt" };
Expand Down
Loading
Loading