|
@@ -48,7 +48,7 @@ public static partial class Application
|
|
|
|
|
|
internal static List<CultureInfo> GetSupportedCultures ()
|
|
internal static List<CultureInfo> GetSupportedCultures ()
|
|
{
|
|
{
|
|
- CultureInfo [] culture = CultureInfo.GetCultures (CultureTypes.AllCultures);
|
|
|
|
|
|
+ CultureInfo [] cultures = CultureInfo.GetCultures (CultureTypes.AllCultures);
|
|
|
|
|
|
// Get the assembly
|
|
// Get the assembly
|
|
var assembly = Assembly.GetExecutingAssembly ();
|
|
var assembly = Assembly.GetExecutingAssembly ();
|
|
@@ -57,15 +57,37 @@ public static partial class Application
|
|
string assemblyLocation = AppDomain.CurrentDomain.BaseDirectory;
|
|
string assemblyLocation = AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
|
|
// Find the resource file name of the assembly
|
|
// Find the resource file name of the assembly
|
|
- var resourceFilename = $"{Path.GetFileNameWithoutExtension (AppContext.BaseDirectory)}.resources.dll";
|
|
|
|
-
|
|
|
|
- // Return all culture for which satellite folder found with culture code.
|
|
|
|
- return culture.Where (
|
|
|
|
- cultureInfo =>
|
|
|
|
- Directory.Exists (Path.Combine (assemblyLocation, cultureInfo.Name))
|
|
|
|
- && File.Exists (Path.Combine (assemblyLocation, cultureInfo.Name, resourceFilename))
|
|
|
|
- )
|
|
|
|
- .ToList ();
|
|
|
|
|
|
+ var resourceFilename = $"{assembly.GetName ().Name}.resources.dll";
|
|
|
|
+
|
|
|
|
+ if (cultures.Length > 1 && Directory.Exists (Path.Combine (assemblyLocation, "pt-PT")))
|
|
|
|
+ {
|
|
|
|
+ // Return all culture for which satellite folder found with culture code.
|
|
|
|
+ return cultures.Where (
|
|
|
|
+ cultureInfo =>
|
|
|
|
+ Directory.Exists (Path.Combine (assemblyLocation, cultureInfo.Name))
|
|
|
|
+ && File.Exists (Path.Combine (assemblyLocation, cultureInfo.Name, resourceFilename))
|
|
|
|
+ )
|
|
|
|
+ .ToList ();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // It's called from a self-contained single.file.
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ // <InvariantGlobalization>false</InvariantGlobalization>
|
|
|
|
+ return
|
|
|
|
+ [
|
|
|
|
+ new ("fr-FR"),
|
|
|
|
+ new ("ja-JP"),
|
|
|
|
+ new ("pt-PT"),
|
|
|
|
+ new ("zh-Hans")
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ catch (CultureNotFoundException)
|
|
|
|
+ {
|
|
|
|
+ // <InvariantGlobalization>true</InvariantGlobalization>
|
|
|
|
+ // Only the invariant culture is supported in globalization-invariant mode.
|
|
|
|
+ return [];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// When `End ()` is called, it is possible `RunState.Toplevel` is a different object than `Top`.
|
|
// When `End ()` is called, it is possible `RunState.Toplevel` is a different object than `Top`.
|