From de8fbe4b5f953c5e0dd0d54ce844708b63454b23 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sun, 29 Jun 2025 19:59:15 -0700 Subject: [PATCH] Update RFC5646 data --- LanguageData/rfc5646 | 8 +++++++- LanguageData/rfc5646.json | 14 +++++++++++++- LanguageTags/LanguageLookup.cs | 4 ++++ LanguageTags/rfc5646DataGen.cs | 11 ++++++++++- LanguageTagsCreate/Program.cs | 2 +- README.md | 6 +++--- 6 files changed, 38 insertions(+), 7 deletions(-) diff --git a/LanguageData/rfc5646 b/LanguageData/rfc5646 index 64c40f2..4f07ca9 100644 --- a/LanguageData/rfc5646 +++ b/LanguageData/rfc5646 @@ -1,4 +1,4 @@ -File-Date: 2025-05-15 +File-Date: 2025-06-23 %% Type: language Subtag: aa @@ -48555,6 +48555,12 @@ Comments: The subtag represents the old orthography of the Latvian language used during c. 1600s–1920s. %% Type: variant +Subtag: viennese +Description: The Viennese dialect of German +Added: 2025-06-22 +Prefix: de +%% +Type: variant Subtag: vivaraup Description: Vivaro-Alpine Added: 2018-04-22 diff --git a/LanguageData/rfc5646.json b/LanguageData/rfc5646.json index 44d9b02..6f24bdb 100644 --- a/LanguageData/rfc5646.json +++ b/LanguageData/rfc5646.json @@ -1,5 +1,5 @@ { - "FileDate": "2025-05-15", + "FileDate": "2025-06-23", "RecordList": [ { "Type": "Language", @@ -94903,6 +94903,18 @@ "lv" ] }, + { + "Type": "Variant", + "SubTag": "viennese", + "Description": [ + "The Viennese dialect of German" + ], + "Added": "2025-06-22", + "Comments": [], + "Prefix": [ + "de" + ] + }, { "Type": "Variant", "SubTag": "vivaraup", diff --git a/LanguageTags/LanguageLookup.cs b/LanguageTags/LanguageLookup.cs index e843077..759a0c0 100644 --- a/LanguageTags/LanguageLookup.cs +++ b/LanguageTags/LanguageLookup.cs @@ -116,6 +116,8 @@ public string GetIsoFromIetf(string languageTag) return match.iso; } + // TODO: Conditional parse and normalize before processing + // Find a matching subtag record Rfc5646Data.Record subtag = _rfc5646.Find(languageTag, false); if (subtag != null) @@ -168,6 +170,8 @@ public string GetIsoFromIetf(string languageTag) public bool IsMatch(string prefix, string languageTag) { + // TODO: Conditional parse and normalize before processing + // https://r12a.github.io/app-subtags/ // zh match: zh: zh, zh-Hant, zh-Hans, zh-cmn-Hant // zho not: zh diff --git a/LanguageTags/rfc5646DataGen.cs b/LanguageTags/rfc5646DataGen.cs index 2866ede..05e9f84 100644 --- a/LanguageTags/rfc5646DataGen.cs +++ b/LanguageTags/rfc5646DataGen.cs @@ -9,7 +9,7 @@ public partial class Rfc5646Data public static Rfc5646Data Create() => new() { - FileDate = new DateOnly(2025, 5, 15), + FileDate = new DateOnly(2025, 6, 23), RecordList = [ new() @@ -84453,6 +84453,15 @@ public static Rfc5646Data Create() => Prefix = [@"lv"], }, new() + { + Type = RecordType.Variant, + SubTag = "viennese", + Added = new DateOnly(2025, 6, 22), + Description = [@"The Viennese dialect of German"], + Comments = [], + Prefix = [@"de"], + }, + new() { Type = RecordType.Variant, SubTag = "vivaraup", diff --git a/LanguageTagsCreate/Program.cs b/LanguageTagsCreate/Program.cs index 607fb31..7efdff4 100644 --- a/LanguageTagsCreate/Program.cs +++ b/LanguageTagsCreate/Program.cs @@ -20,7 +20,7 @@ public static class Program private static async Task DownloadFileAsync(Uri uri, string fileName) { Log.Information("Downloading \"{Uri}\" to \"{FileName}\" ...", uri.ToString(), fileName); - Stream httpStream = await GetHttpClient().GetStreamAsync(uri); + await using Stream httpStream = await GetHttpClient().GetStreamAsync(uri); await using FileStream fileStream = File.Create(fileName); await httpStream.CopyToAsync(fileStream); } diff --git a/README.md b/README.md index ed1c5cb..d45e091 100644 --- a/README.md +++ b/README.md @@ -166,9 +166,9 @@ IETF language tags are in the form of `[Language]-[Extended language]-[Script]-[ Examples: -- `pt` will match `pt` Portuguese, or `pt-BR` Brazilian Portuguese, or `pt-PT` European Portuguese.\ -- `pt-BR` will only match `pt-BR` Brazilian Portuguese.\ -- `zh` will match `zh` Chinese, or `zh-Hans` simplified Chinese, or `zh-Hant` for traditional Chinese, and other variants.\ +- `pt` will match `pt` Portuguese, or `pt-BR` Brazilian Portuguese, or `pt-PT` European Portuguese. +- `pt-BR` will only match `pt-BR` Brazilian Portuguese\ +- `zh` will match `zh` Chinese, or `zh-Hans` simplified Chinese, or `zh-Hant` for traditional Chinese, and other variants. - `zh-Hans` will only match `zh-Hans` simplified Chinese. ```csharp