github repo github stars

Multilingualism

Bit TodoTemplate provides features in order add support for Multilingualism.

Enable Multilingualism

To activate the Multilingual feature of the app, set the EnableMultilingual to true in the Directory.Build.props file.
To add a new Culture, add it to the list of SupportedCultures in the CultureInfoManager class and add the corresponding translations in a new AppStrings.[culture-name].resx file named based on the new culture's name (e.g AppStrings.fr.resx for French).
You also can customize the details of each culture in the CreateCultureInfo method, and the implementations of the Bit Platform templates will apply these changes in all of the supported platforms: Web, Windows, iOS, Android, and even in Pre-Rendering.
The required translations of the DTO's Validation Annotations will come from the values inside the AppStrings.resx file by default. But you can add separate .resx files and use them instead by adding the DtoResourceTypeAttribute on the DTO classes. For example, to use a custom .resx file named CustomersManagement.resx for a specific DTO, the attribute used on that DTO should look like this:
[DtoResourceType(typeof(CustomersManagement)]
public class CustomerDto
{
    ...
}
You can also inject the specific StringLocalizer of this custom .resx file like this:
[AutoInject] private IStrignLocalizer<CustomersManagement> _customersManagementLocalizer;
And use it to access the translations inside that page.