diff --git a/src/OrchardCore/OrchardCore.Localization.Abstractions/Extensions/CultureInfoExtensions.cs b/src/OrchardCore/OrchardCore.Localization.Abstractions/Extensions/CultureInfoExtensions.cs new file mode 100644 index 00000000000..92ffee6d3f8 --- /dev/null +++ b/src/OrchardCore/OrchardCore.Localization.Abstractions/Extensions/CultureInfoExtensions.cs @@ -0,0 +1,23 @@ +using System.Globalization; + +namespace OrchardCore.Localization; + +/// +/// Provides an extension methods for to deal with language direction. +/// +public static class CultureInfoExtensions +{ + /// + /// Gets the language direction for a given culture. + /// + /// The . + public static string GetLanguageDirection(this CultureInfo culture) => culture.IsRightToLeft() + ? LanguageDirection.RTL + : LanguageDirection.LTR; + + /// + /// Gets whether the culture is RTL or not. + /// + /// The culture. + public static bool IsRightToLeft(this CultureInfo culture) => culture.TextInfo.IsRightToLeft; +} diff --git a/src/OrchardCore/OrchardCore.Localization.Abstractions/LanguageDirection.cs b/src/OrchardCore/OrchardCore.Localization.Abstractions/LanguageDirection.cs index 45bb2a79bcd..29c84cb2fc2 100644 --- a/src/OrchardCore/OrchardCore.Localization.Abstractions/LanguageDirection.cs +++ b/src/OrchardCore/OrchardCore.Localization.Abstractions/LanguageDirection.cs @@ -1,36 +1,17 @@ -using System.Globalization; +namespace OrchardCore.Localization; -namespace OrchardCore.Localization +/// +/// Provides a language directions. +/// +public static class LanguageDirection { /// - /// Provides a language directions and helper methods that extend . + /// Defines left to right direction. /// - public static class LanguageDirection - { - /// - /// Defines left to right direction. - /// - public static readonly string LTR = "ltr"; + public static readonly string LTR = "ltr"; - /// - /// Defines right to left direction. - /// - public static readonly string RTL = "rtl"; - - /// - /// Gets the language direction for a given culture. - /// - /// The . - /// - public static string GetLanguageDirection(this CultureInfo culture) - => culture.TextInfo.IsRightToLeft ? RTL : LTR; - - /// - /// Gets whether the culture is RTL or not. - /// - /// The culture. - /// - public static bool IsRightToLeft(this CultureInfo culture) - => culture.TextInfo.IsRightToLeft; - } + /// + /// Defines right to left direction. + /// + public static readonly string RTL = "rtl"; }