NLanguageTag 4.0.0

dotnet add package NLanguageTag --version 4.0.0
NuGet\Install-Package NLanguageTag -Version 4.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NLanguageTag" Version="4.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NLanguageTag --version 4.0.0
#r "nuget: NLanguageTag, 4.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NLanguageTag as a Cake Addin
#addin nuget:?package=NLanguageTag&version=4.0.0

// Install NLanguageTag as a Cake Tool
#tool nuget:?package=NLanguageTag&version=4.0.0


Language tags are used to help identify languages, whether spoken, written, signed, or otherwise signaled, for the purpose of communication. Language tag syntax is defined by the IETF's BCP 47

This library implements all subtags from the BCP47 (RFC 5646) specification. Subtag enumerations are generated using code generation from the IANA Language Subtag Registry. Updating the subtag registry does not break the backward binary compatibility of this library.

NuGet Version NuGet Downloads


Fields of LanguageTag

  • Language - The primary language subtag is the first subtag in a language tag
  • Script - Script subtags are used to indicate the script or writing system variations that distinguish the written forms of a language or its dialects
  • Region - Region subtags are used to indicate linguistic variations associated with or appropriate to a specific country, territory, or region.
  • Variants - Variant subtags are used to indicate additional, well-recognized variations that define a language or its dialects that are not covered by other available subtags.
  • Extensions - Extensions provide a mechanism for extending language tags for use in various applications.
  • PrivateUse - Private use subtags are used to indicate distinctions in language that are important in a given context by private agreement.


var en = Language.EN; // English language
var zh = Language.ZH; // Chinese language

var latn = Script.Latn; // Latin script
var hans = Script.Hans; // Han (Simplified variant)

var tw = Region.TW; // Taiwan, Province of China

// tag zh-Hans-TW
var tag1 = new LanguageTag(zh, hans, tw);

// tag zh-Latn-TW-Pinyin
var tag2 = new LanguageTag(zh, latn, tw, new []{ Variant.Pinyin });

// tag en-US-x-twain
var tag3 = new LanguageTag(en, Region.US, ExtensionSubtag.ForPrivateUse("twain"));

// tag de-DE-u-co-phonebk
var tag4 = new LanguageTag(
	new []{ new ExtensionSubtag('u', "co", "phonebk") });


var tag3 = LanguageTag.Parse("ru");
var tag4 = LanguageTag.Parse("zh-Hans-TW");
var tag5 = LanguageTag.Parse("en-GB-scotland");

Any operation

// Equals
Assert.True(tag1 == tag6);

// zh-Hans-TW -> zh-Hans
var tag8 = tag6.Take(LanguageTag.Field.Language | LanguageTag.Field.Script);

// zh-Hans is subset of zh-Hans-TW
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NLanguageTag:

Package Downloads

This package provides HSM base types in .net projects.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 1,674 2/21/2024
3.2.0 38,564 3/20/2022
3.1.0 17,023 6/30/2021
3.0.0 327 6/30/2021
2.0.0 15,089 11/27/2019