Base solution for your next web application
Open Closed

translation #12617


User avatar
0
ricardo created

hello,

Where I perform the translation of the message marked in red in the image below:

thanks.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

8 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @ricardo

    You need to update the localization XML file for the primary language used in your project. The localization keys provided by ASP.NET Identity (English version) are available at the GitHub link below. We recommend adding these keys to your primary language XML file. Please note that these keys should not already exist in your primary language XML file.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ricardo created

    Hi @oguzhanagir

    We added the keys to the file but we are still getting the message without the translation.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @ricardo

    The Identity error messages are loaded from ABP's AbpZero localization source, not from your application's source. To use your translations, you need to extend the AbpZero source with your own.

    Add this line to your YourProjectNameLocalizationConfigurer.cs:

    public static void Configure(ILocalizationConfiguration localizationConfiguration)
    {
        localizationConfiguration.Sources.Add(
            new DictionaryBasedLocalizationSource(
                AbpZeroTemplateConsts.LocalizationSourceName,
                new XmlEmbeddedFileLocalizationDictionaryProvider(
                    typeof(AbpZeroTemplateLocalizationConfigurer).GetAssembly(),
                    "MyCompanyName.AbpZeroTemplate.Localization.AbpZeroTemplate"
                )
            )
        );
    
        // Add this line to extend AbpZero source with your translations
        localizationConfiguration.Sources.Extensions.Add(
            new LocalizationSourceExtensionInfo(
                "AbpZero",
                new XmlEmbeddedFileLocalizationDictionaryProvider(
                    typeof(AbpZeroTemplateLocalizationConfigurer).GetAssembly(),
                    "MyCompanyName.AbpZeroTemplate.Localization.AbpZeroTemplate"
                )
            )
        );
    }
    

    You'll also need to add this using statement:

    using Abp.Localization.Sources;
    

    After this change, ABP will look for Identity.* keys in your localization files when displaying Identity error messages.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ricardo created

    Hi,

    Sorry for the late reply, but we implemented the suggested solution and it's still not working.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @ricardo

    After implementing this configuration, have you added the necessary localization keys (found at this link) to your XML files? Make sure you add them to the XML file for the language you are using. If this fix doesn't solve your problem, please don't hesitate to contact us. Thank you.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ricardo created

    Hi @oguzhanagir

    Yes, we added the keys, but the translation still hasn't happened.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ricardo

    Instead of adding these localization definitions to your existing file, could you create "AbpZero-pt-BR.xml" and "AbpZero.xml" in the same directory and add these translations to these files ?

    • Don't forget to set culture in these files as shown below

    • Also, be sure to mark these files as embedded resource

    For more info, you can check https://aspnetboilerplate.com/Pages/Documents/Localization#extending-localization-sources.

    If this still doesn't work, please send an email to [email protected] so we can help you further.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ricardo created

    Hi @ismcagdas

    It worked by adding AbpZero-pt-BR.xml

    thank you

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)