Skip to content

Can't get localization working... #1192

Answered by ArgoZhang
tdittmar asked this question in Q&A
Discussion options

You must be logged in to vote

copy json localization file

copy https://github.com/dotnetcore/BootstrapBlazor/blob/main/localization/de.json file into your project /Locales/de.json and set build action to Embedded resource

configuration

builder.Services.AddBootstrapBlazor(localizationConfigure: op =>
{
    op.AdditionalJsonAssemblies = new Assembly[]
    {
        typeof(Main).Assembly,
    };
});

builder.Services.Configure<BootstrapBlazorOptions>(op =>
{
    op.DefaultCultureInfo = "de";
    op.SupportedCultures = new List<string> { "de" };
});

var culture = new CultureInfo("de-DE");
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;    

before return builder.Bu…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@tdittmar
Comment options

@densen2014
Comment options

@tdittmar
Comment options

@ArgoZhang
Comment options

Answer selected by ArgoZhang
@tdittmar
Comment options

@tdittmar
Comment options

@densen2014
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants