New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to localize Login/Logout text in menu (or the login window there after)? #7280
Comments
Login / Logout is not a localizable string: https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor You could override the component: Or customize the basic theme: |
Is there something stopping me from trying to create a PR for that? Is there some reason the strings are not localized there? But how about the page after pressing the Login button? This Login.cshtml There we have @l["AreYouANewUser"] but with my code above and this added to the json file it doesn't take.. "AreYouANewUser": "Ertu nýr notandi?",
"Authentication:AreYouANewUser": "Ertu nýr notandi?",
"Volo.Abp.Account:AreYouANewUser": "Ertu nýr notandi?",
"Login:Volo.Abp.Account.AreYouANewUser": "Ertu nýr notandi?",
"Default:AreYouANewUser": "Ertu nýr notandi?",
"Account:AreYouANewUser": "Ertu nýr notandi?",
"Account::AreYouANewUser": "Ertu nýr notandi?",
"Account:Login:AreYouANewUser": "Ertu nýr notandi?",
"AbpAccount:AreYouANewUser": "Ertu nýr notandi?",
"AbpUi:AreYouANewUser": "Ertu nýr notandi?" That might be because of So..? Btw thank you @d-oit for your other suggestions. I´ll try them out for the Login text.. |
UPDATEThe localization overriding is working fine with the changes below. It was a bug specifically in Identity localization: cc1c1d3#diff-64394e2c990c78aa48c6d551c9e82a16ed963b96d17bdf1a9adbcf3029d6c642 ========== I precisely followed the abp docs and it isn't working for me either. I want to change this localized string: abp/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json Line 47 in badad8d
In the [DependsOn(
//...
typeof(AbpIdentityDomainSharedModule),
//...
)]
public class MyProjectDomainSharedModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<Volo.Abp.Identity.Localization.IdentityResource>()
.AddVirtualJson("/Localization/Resources/Identity/Extensions");
});
}
} My csproj project file includes the embedded resource <ItemGroup>
<EmbeddedResource Include="Localization\**\*.json" />
<Content Remove="Localization\**\*.json" />
</ItemGroup> The text is not overridden. I have also added this to the HttpApi.Host module and used |
hi @olicooper Can you share a project to show the problem? |
@maliming I don't think the problem I mention above is a localization issue, it is due to the bug I mention here. I can create a project to show the |
Please share it, thanks. |
Here is a sample that should work. Go to appsettings.json and update TestUserId with the host admin Id in your database. Update |
Thanks @olicooper
|
See #7362 |
@sturlath Sorry for hijacking your issue! I have tested the public class MyProjectApplicationContractsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<Volo.Abp.Account.Localization.AccountResource>()
.AddVirtualJson("/Localization/AbpAccount");
});
}
} I have left my localization *.json files in my You shouldn't need to use
I would say yes to creating a PR for the login text here, because a 'Login' localization already exists but it isn't being used in the menu bar for blazor apps. you can see all the places it is used here. @maliming After looking at the issues created about localization, I wonder if the localization docs might need to be expanded to explain which module to place the override configuration in along with an example of overriding a built-in resource like |
An example to explain how to extend localization resource. |
I have read the localization docs (and the extending resources) in/out and I can't figure out how I can override the default English translations that I have not set, like "Log in" etc.
It must be possible to override it even though the system doesn't currently come with Icelandic, right?
I just can't change the text Login to "Innskrá"!
I have tried to add all thinkable resources (they are quite a few)
See my code
Now that I'm writing this, I'm thinking that the lack of Volo.Abp.Account.Localization.AccountResource might be the problem. The project doesn't have access to it?
I have even tried all kinds of "overrides" in the is.json file
I have searched open/cloes issues and found few similar but they did'nt help. See this, this and this one
Version and code
Running apb.io version 4.1.1 and Blazor
I have created a test project with this code if you like to try it out
The text was updated successfully, but these errors were encountered: