Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion LanguageData/rfc5646
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
File-Date: 2025-05-15
File-Date: 2025-06-23
%%
Type: language
Subtag: aa
Expand Down Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion LanguageData/rfc5646.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"FileDate": "2025-05-15",
"FileDate": "2025-06-23",
"RecordList": [
{
"Type": "Language",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions LanguageTags/LanguageLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion LanguageTags/rfc5646DataGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion LanguageTagsCreate/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down