-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adjust examples project; bump version
- Loading branch information
Showing
5 changed files
with
27 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"MyText": "Hallo Welt (German)" | ||
"MyText": "Hallo Welt (German)", | ||
"Sub": { | ||
"Nested": "Kind (German)" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"MyText": "Hello World (English)" | ||
"MyText": "Hello World (English)", | ||
"Sub": { | ||
"Nested": "Child (English)" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
using System; | ||
using System.Globalization; | ||
|
||
namespace kli.Localize.Example | ||
namespace kli.Localize.Example; | ||
|
||
class Program | ||
{ | ||
class Program | ||
static void Main(string[] args) | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
// Neutral/Invariant | ||
Console.WriteLine(Localizations.MyLocale.MyText); // Hallo Welt (German) | ||
// Neutral/Invariant | ||
Console.WriteLine(Localizations.MyLocale.MyText); // Hallo Welt (German) | ||
Console.WriteLine(Localizations.MyLocale.Sub.Nested); // Kind (German) | ||
|
||
CultureInfo.CurrentUICulture = new CultureInfo("en"); | ||
Console.WriteLine(Localizations.MyLocale.MyText); // Hello World (English) | ||
CultureInfo.CurrentUICulture = new CultureInfo("en"); | ||
Console.WriteLine(Localizations.MyLocale.MyText); // Hello World (English) | ||
Console.WriteLine(Localizations.MyLocale.Sub.Nested); // Child (English) | ||
|
||
CultureInfo.CurrentUICulture = new CultureInfo("en-US"); | ||
Console.WriteLine(Localizations.MyLocale.MyText); // Hello World (English) -- Fallback to Parent.Culture | ||
CultureInfo.CurrentUICulture = new CultureInfo("en-US"); | ||
Console.WriteLine(Localizations.MyLocale.MyText); // Hello World (English) -- Fallback to Parent.Culture | ||
Console.WriteLine(Localizations.MyLocale.Sub.Nested); // Child (English) -- Fallback to Parent.Culture | ||
|
||
CultureInfo.CurrentUICulture = new CultureInfo("fr"); | ||
Console.WriteLine(Localizations.MyLocale.MyText); // Hallo Welt (German) -- Fallback to Neutral | ||
} | ||
CultureInfo.CurrentUICulture = new CultureInfo("fr"); | ||
Console.WriteLine(Localizations.MyLocale.MyText); // Hallo Welt (German) -- Fallback to Neutral | ||
Console.WriteLine(Localizations.MyLocale.Sub.Nested); // Kind (German) -- Fallback to Neutral | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters