"me-web?" 0.7.0: the name in quotes, copy buttons, and every translation rewritten in plain words
- The name is now always written in quotation marks, each language with its own: “me-web?”, «me-web?», „me-web?“, « me-web? », 「me-web?」. Without them the question mark read as the end of a sentence. In Arabic, Hebrew and the other right-to-left languages the question mark no longer jumps to the wrong side of the name. - Your addresses, your router, your network, the reverse name, the route and the code of a submission you sent now sit in a small box with a copy button, ready to paste into a message to your provider or anywhere else. - Every translation except English and Italian was rewritten for people who are not technical: everyday words first, the technical term in brackets, and one word for one thing across the whole app. They are still machine drafts; "Suggest a correction" is welcome in any language. - A few lines are plainer in English and Italian too: the test servers for calls, and the server in the middle that carries a call when two homes can't connect directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
This commit is contained in:
1 parent
d18caed157
commit
320936c688
260 files changed
+23662
-18072
No files matched your search
@@ -32,6 +32,32 @@ var supplied = new Dictionary<string, (string Name, string English, bool Rtl)>
|
||||
["wni"] = ("Shindzuani", "Ndzwani Comorian", false),
|
||||
["zdj"] = ("Shingazidja", "Ngazidja Comorian", false),
|
||||
};
|
||||
var suppliedQuotes = new Dictionary<string, string[]>
|
||||
{
|
||||
["ay"] = ["«", "»"],
|
||||
["bi"] = ["“", "”"],
|
||||
["dv"] = ["”", "“"],
|
||||
["fj"] = ["“", "”"],
|
||||
["gil"] = ["“", "”"],
|
||||
["gn"] = ["«", "»"],
|
||||
["hif"] = ["“", "”"],
|
||||
["ho"] = ["“", "”"],
|
||||
["ht"] = ["«\u00A0", "\u00A0»"],
|
||||
["mh"] = ["“", "”"],
|
||||
["ms-Arab"] = ["“", "”"],
|
||||
["na"] = ["“", "”"],
|
||||
["ny"] = ["“", "”"],
|
||||
["pau"] = ["“", "”"],
|
||||
["sm"] = ["“", "”"],
|
||||
["ss"] = ["“", "”"],
|
||||
["tet"] = ["“", "”"],
|
||||
["tpi"] = ["“", "”"],
|
||||
["tvl"] = ["“", "”"],
|
||||
["wni"] = ["«\u00A0", "\u00A0»"],
|
||||
["zdj"] = ["«\u00A0", "\u00A0»"],
|
||||
};
|
||||
var spacedQuotes = new HashSet<string> { "fr" };
|
||||
var fixedQuotes = new Dictionary<string, string[]> { ["st"] = ["“", "”"] };
|
||||
|
||||
var root = FindRoot();
|
||||
var target = Path.Combine(root, "data", "languages.json");
|
||||
@@ -41,6 +67,7 @@ var baseUrl = $"https://raw.githubusercontent.com/unicode-org/cldr-json/{Cldr}/c
|
||||
var territories = JsonNode.Parse(await http.GetStringAsync($"{baseUrl}/territoryInfo.json"))["supplemental"]["territoryInfo"].AsObject();
|
||||
var containment = JsonNode.Parse(await http.GetStringAsync($"{baseUrl}/territoryContainment.json"))["supplemental"]["territoryContainment"];
|
||||
var members = containment["UN"]["_contains"].AsArray().Select(n => (string)n).ToHashSet();
|
||||
var miscUrl = $"https://raw.githubusercontent.com/unicode-org/cldr-json/{Cldr}/cldr-json/cldr-misc-full/main";
|
||||
|
||||
var known = CultureInfo.GetCultures(CultureTypes.NeutralCultures | CultureTypes.SpecificCultures).Select(c => c.Name).ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||
var codes = new SortedSet<string>(unLanguages, StringComparer.Ordinal);
|
||||
@@ -68,6 +95,7 @@ foreach (var code in codes)
|
||||
{
|
||||
var (name, english, rtl) = supplied.TryGetValue(code, out var given) ? given : FromCulture(code);
|
||||
var status = reviewed.Contains(code) ? "reviewed" : previous.GetValueOrDefault(code) ?? "draft";
|
||||
var quotes = await Quotes(code);
|
||||
list.Add((JsonNode)new JsonObject
|
||||
{
|
||||
["code"] = code,
|
||||
@@ -75,6 +103,7 @@ foreach (var code in codes)
|
||||
["english"] = english,
|
||||
["rtl"] = rtl,
|
||||
["status"] = status,
|
||||
["quotes"] = new JsonArray(quotes[0], quotes[1]),
|
||||
});
|
||||
}
|
||||
File.WriteAllText(target, list.ToJsonString(new JsonSerializerOptions { WriteIndented = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }) + "\n");
|
||||
@@ -82,6 +111,21 @@ Console.WriteLine($"{list.Count} languages written to data/languages.json (CLDR
|
||||
if (missing.Count > 0) Console.WriteLine($"official but neither in ICU nor supplied, left out: {string.Join(", ", missing)}");
|
||||
return 0;
|
||||
|
||||
async Task<string[]> Quotes(string code)
|
||||
{
|
||||
if (suppliedQuotes.TryGetValue(code, out var given) || fixedQuotes.TryGetValue(code, out given)) return given;
|
||||
foreach (var locale in new[] { code, code.Split('-')[0] }.Distinct())
|
||||
{
|
||||
using var response = await http.GetAsync($"{miscUrl}/{locale}/delimiters.json");
|
||||
if (!response.IsSuccessStatusCode) continue;
|
||||
var delimiters = JsonNode.Parse(await response.Content.ReadAsStringAsync())["main"].AsObject().First().Value["delimiters"];
|
||||
var open = (string)delimiters["quotationStart"];
|
||||
var close = (string)delimiters["quotationEnd"];
|
||||
return spacedQuotes.Contains(code) ? [open + "\u00A0", "\u00A0" + close] : [open, close];
|
||||
}
|
||||
throw new InvalidOperationException($"{code}: no quotation marks in CLDR and none supplied");
|
||||
}
|
||||
|
||||
(string Name, string English, bool Rtl) FromCulture(string code)
|
||||
{
|
||||
var culture = CultureInfo.GetCultureInfo(code);
|
||||
|
||||
Reference in new issue
Block a user