ABP's localization system is seamlessly integrated to the `Microsoft.Extensions.Localization` package and compatible with the [Microsoft's localization documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization). It adds some useful features and enhancements to make it easier to use in real life application scenarios.
Volo.Abp.Localization is the core package of the localization system. Install it to your project using the package manager console (PMC):
```
Install-Package Volo.Abp.Localization
```
Then you can add **AbpLocalizationModule** dependency to your module:
```c#
using Volo.Abp.Modularity;
using Volo.Abp.Localization;
namespace MyCompany.MyProject
{
[DependsOn(typeof(AbpLocalizationModule))]
public class MyModule : AbpModule
{
//...
}
}
```
#### Creating A Localization Resource
A localization resource is used to group related localization strings together and separate them from other localization strings of the application. A module generally defines its own localization resource. Localization resource is just a plain class. Example:
````C#
public class TestResource
{
}
````
Then it should be added using `AbpLocalizationOptions` as shown below:
````C#
[DependsOn(typeof(AbpLocalizationModule))]
public class MyModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)
* Every localization file should define the `culture` code for the file (like "en" or "en-US").
*`texts` section just contains key-value collection of the localization strings (keys may have spaces too).
##### Short Localization Resource Name
Localization resources are also available in the client (JavaScript) side. So, setting a short name for the localization resource makes it easy to use localization texts. Example:
See the Getting Localized Test / Client Side section below.
##### Inherit From Other Resources
A resource can inherit from other resources which makes possible to re-use existing localization strings without referring the existing resource. Example:
````C#
[InheritResource(typeof(AbpValidationResource))]
public class TestResource
{
}
````
Alternative inheritance by configuring the `AbpLocalizationOptions`:
* If the new resource defines the same localized string, it overrides the string.
##### Extending Existing Resource
Inheriting from a resource creates a new resource without modifying the existing one. In some cases, you may want to not create a new resource but directly extend an existing resource. Example:
public MyService(IStringLocalizer<TestResource> localizer)
{
_localizer = localizer;
}
public void Foo()
{
var str = _localizer["HelloWorld"];
}
}
````
###### Simplest Usage In A Razor View/Page
````c#
@inject IHtmlLocalizer<TestResource> Localizer
<h1>@Localizer["HelloWorld"]</h1>
````
Refer to the [Microsoft's localization documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization) for details about using localization on the server side.