Some more culture info page improvements

This commit is contained in:
Rick Falkvinge
2019-01-24 21:47:35 +01:00
parent 98e4eba961
commit 9a38b284e7
2 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -374,7 +374,7 @@ namespace Swarmops.Logic.Support
{
get
{
return new string[] { "ar-AE", "de-DE", "yo-Latn" /* Yoruba writes as Èbè */, "el" /* Greek writes as Ellenika */ , "es-ES", "fr-FR", "fil-Latn", "it-IT", "nl-NL", "pl-PL", "pt-PT", "ru-RU", "sr-Cyrl-RS", "sr-Latn-RS", "sv-SE", "tr-TR", "zh-CHS" };
return new string[] { "ar-AE", "de-DE", "yo-Latn" /* Yoruba writes as Èbè */, "el-GR" /* Greek writes as Ellenika */ , "es-ES", "fr-FR", "fil-Latn", "it-IT", "nl-NL", "pl-PL", "pt-PT", "ru-RU", "sr-Cyrl-RS", "sr-Latn-RS", "sv-SE", "tr-TR", "zh-CHS" };
// the above locales are sorted by the language NATIVE name, to make the list maximally useful
}
+9 -5
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Globalization;
using System.Text;
using System.IO;
@@ -26,16 +27,19 @@ namespace Swarmops.Frontend.Pages.v5.Admin
private static string AllCulturesAsJson()
{
StringBuilder result = new StringBuilder(16384);
Dictionary<string, bool> cultureLookup = new Dictionary<string, bool>();
Dictionary<string, bool> cultureFullLookup = new Dictionary<string, bool>();
Dictionary<string, bool> culturePartialLookup = new Dictionary<string, bool>();
string[] supportedCultures = Swarmops.Logic.Support.Formatting.SupportedCultures;
foreach (string culture in supportedCultures)
{
cultureLookup[culture] = true;
cultureFullLookup[culture] = true;
culturePartialLookup[culture.Substring(0, culture.IndexOf('-'))] = true;
}
string yesImage = "<img src='/Images/Icons/iconshock-green-tick-128x96px.png' height='24' width='32' />";
string noImage = "<img src='/Images/Icons/iconshock-red-cross-128x96px.png' height='24' width='32' />";
string yesImage = "<img src='/Images/Icons/iconshock-green-tick-128x96px.png' height='20' width='26' />";
string halfImage = "<img src='/Images/Icons/iconshock-gold-tick-128x96px.png' height='16' width='21' />";
string noImage = "<img src='/Images/Icons/iconshock-red-cross-128x96px.png' height='12' width='16' />";
result.Append("{\"rows\":[");
@@ -69,7 +73,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
region.DisplayName,
region.EnglishName,
flagFile.Length > 2? flagFile : noImage,
cultureLookup.ContainsKey(culture.Name)? yesImage: noImage
cultureFullLookup.ContainsKey(culture.Name)? yesImage: culturePartialLookup.ContainsKey(culture.Name.Substring(0, culture.Name.IndexOf('-')))? halfImage: noImage
);
result.Append("},");