You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.NET most advanced localization package for your solutions, light, fast, super easy to use, and much more.
18
+
Making your app available in many languages should be a simple straightforward process, *AKSoftware.Localization.Multilanguages* offers the ultimate solution.
Build awesome .NET applications that supports more than 69+ languages with just a few lines of code, in addition to an easy translation tool that helps you translate all your content to any language you want with just one click
16
25
17
26
Could be used for all type of .NET Apps (Blazor, UWP, Xamarin, Windows, ASP.NET Core MVC, Razor Pages ....)
18
27
@@ -37,103 +46,92 @@ https://youtu.be/Xz68c8GBYz4
37
46

38
47
39
48
40
-
# What's new in Version 5.9.0
41
-
Version 5.9.0 with two big achievements:
42
-
1. The performance of the library has been improved by 5x especially while retrieving nested keys, due to eliminate the usage of JSON in some places and depend efficiently on the YAML library.
43
-
2. The ability to store the Resources in an external folder with a specified path that you can define
44
-
To use this feature without using Dependency Injection
45
-
You can refer to this sample file here:
46
-
[Program.cs sample to fetch keys from folder](https://github.com/aksoftware98/multilanguages/blob/master/src/ConsoleAppSample/Program.cs)
49
+
# Why YAML
50
+
Most common solution for multilanguage in .NET is the .resx resource files. .resx files are XML based so they are not too friendly to deal with and most likely a GUI tool is needed for keys management. XML is also huge and slower to parse. On the other hand, YAML is new, very fast to parse, and file structure is very simple and doesn't contain any single not-needed character which make the file size too small comparing to the XML one.
51
+
For modern SPA apps with Blazor WebAssembly for example, large language files with .resx might slow down the load time for the download.
52
+
YAML file structure allows for nested objects which a lovely feature you can take advantage of to build an organized language key-values files without long concatenated names.
53
+
Finally, due to the simplicity of YAML, it's makes it very easy to build automation on top of it like source generator and static classes creation.
47
54
48
-
If you are using dependency injection you can use the newly used method:
49
-
```C#
50
-
// For .NET projects consider the following method
AKSoftware.Localization.Multilanguage prvoides all the feature set needed for any multilanguage support like:
57
+
- Easy to get started.
58
+
- Online traslator tool to translate your files in one click for more 65 languages https://akmultilanguages.azurewebsites.net
59
+
- Light and high-performant
60
+
- Blazor Server & WebAssembly support
61
+
- Out of the box state management for **Blazor** components
62
+
- Multiple language file sources (Files in folder or embedded files)
63
+
- String interpolation support
64
+
- Dynamically list all language keys
65
+
- Dynamically list all available langauges
66
+
- Dependency injection support
67
+
- Hierarcy language keys in YAML
68
+
- Code generators to generate full keys accessor service, static class with const strings, enums, and more..
69
+
- v6.1 will bring the localization assistant to localize existing apps with minimal effort.
70
+
- Full UWP support
56
71
57
-
**Keep in mind, the folder of the resources has to be shipped with your project**
58
72
59
-
# What's new in Version 5.8.0
60
-
Finally **Blazor Server** is here you can get started now.
61
-
The **only** change that you need to do that is different from others is in your **program.cs** file make sure to use the following function to register the Language Container
62
-
```C#
63
-
...
64
-
// Register the language container for Blazor Server
Check out the following [Blazor Server Sample](https://github.com/aksoftware98/multilanguages/tree/master/src/BlazorServerLocalizationSample)
69
73
70
-
# UWP Support in Version 5.0.0
74
+
# Getting Started
71
75
72
-
Special thanks for the contributor [Michael Gerfen](https://github.com/gerfen) for updating the library to add support to the UWP.
76
+
73
77
74
-
This version contains a major update that adds support for a new package under the name AKSoftware.Localization.MultiLangauges.UWP you can install it from Nuget with the following command
In the latest version of the library because right it started to support UWP and not only Blazor a new interface and abstract type has been introduced that allows you to easily create a keys provider to fetch your keys not only from the embedded resources, also from any source you would like (External folder, FTP, Azure Blob Storage ...etc)
89
-
90
-
By default there is the ***EmbeddedResourceKeysProvider*** to fetch the files from the resources and you can create your own by inhereting from the interface ***IKeysProvider***
> When using the source generator, the package will take care of setting the file as embedded resources, and it generates a new interface named **IKeysAccessor** this service wraps the access to all the keys and tested keys in your language files.
133
+
>
134
+
> However, the package must be installed the project that contains the en-US.yml file, so if your solution is a single project you can directly install it in the same project. If your solution consists of multiple projects and you want to use the localization across all of them, make sure to create a seperate project for localization and reference it in your other projects.
137
135
138
136
139
137
## Create the Resources Folder
@@ -166,6 +164,9 @@ Welcome: Welcome
166
164
167
165
Select the file in the Solution Explorer window and from the properties window set the build action property to "Embeded Resources"
168
166
167
+
>**Note**
168
+
>In case of using the Source Generator package, that will be taken care of automatically.
If you don't specify a default culture the library will try to find the file that matches the culture of the current user, if it's not existing it will try to find any file that matches the same language, then if it's not there it will try to find the English file then the first file in the folder, otherwise it will throw an exception
234
235
236
+
> **Source Generator Note**
237
+
> In case of using the Source Generator and want to have direct access without using the ILanguageContainerService and provide the key as string make sure to also register the auto-generated interface instance in your dependency injection container:
238
+
> ``
239
+
> builder.Services.AddKeysAccessor();
240
+
> ``
241
+
235
242
236
243
237
244
@@ -249,25 +256,32 @@ using AKSoftware.Localization.MultiLanguages.Blazor
@@ -568,7 +576,7 @@ As you are adding and changing Razor files in your your project, you can verify
568
576
569
577
Example:
570
578
571
-
```C#
579
+
```csharp
572
580
/// <summary>
573
581
/// If this test is failing it means that there are new strings in your razor file or in your model file Required Attribute that need to be localized.
574
582
/// </summary>
@@ -611,7 +619,7 @@ You can verify that there is not a typo in your Razor file for the localization
611
619
612
620
Example:
613
621
614
-
```C#
622
+
```csharp
615
623
/// <summary>
616
624
/// If this test is failing it means that you manually typed in a key in your razor file,
617
625
/// and it does not exist in the en-US.yml file, or you deleted a key value pair in the en-Us.yml file that was in use.
@@ -655,7 +663,7 @@ Detect if you have keys in your en-US.yml file that are not being used in your r
655
663
656
664
Example:
657
665
658
-
```C#
666
+
```csharp
659
667
/// <summary>
660
668
/// If this test is failing, it means that you have keys in your en-US.yml file that are not being used in your razor files.
661
669
/// </summary>
@@ -699,7 +707,7 @@ public void VerifyNoUnusedKeys()
699
707
In this situation, there are strings that need to be localized but it would result in duplicate keys if automatically created. You might need to manually create the key and values.
700
708
701
709
Example
702
-
```C#
710
+
```csharp
703
711
/// <summary>
704
712
/// If this test is failing it means that there are new strings that need to be localized
705
713
/// and if they were to be created automatically, there would be the same key that have different values
0 commit comments