Closed jimmy84 closed 7 years ago
Yes, this would be possible, will need to make a small change, will add it to the next version
Great can't wait! :)
Hi @jimmy84 I reopened this, will close it once it implemented, thanks
Thumb up for this feature ! Thanks Damien.
@jimmy84 @frontegi Can you give your 2 cents?
The full computed key is returned per default. I like this because if a localization is missing from the database, I see what I need to add.
The following configuration returns the default keys, if the localization record does not exist. OK?
var useTypeFullNames = true;
var useOnlyPropertyNames = false;
var returnOnlyKeyIfNotFound = true;
services.AddSqlLocalization(options => options.UseSettings(
useTypeFullNames,
useOnlyPropertyNames,
returnOnlyKeyIfNotFound
));
Here's the pull request.
https://github.com/damienbod/AspNet5Localization/pull/23
I will create a new package for this once this is merged.
Greetings Damien
Looks great to me! I'm so excited! Haha.
@damienbod I tested the 1.0.6 version, it seems the returnOnlyKeyIfNotFound only works on SharedResouce (IHtmlLocalizer). It doesn't work on normal view(IViewLocalizer) localizer.
I have following config
services.AddSqlLocalization(options =>
{
options.UseTypeFullNames = false;
options.UseOnlyPropertyNames = false;
options.ReturnOnlyKeyIfNotFound = true;
});
This is what I had in my _ViewImports.chtml
@inject IViewLocalizer Localizer
@inject IHtmlLocalizer<SharedResource> SharedLocalizer
Localizer not working. SharedLocalizer is working fine.
Hi, Is there anyway to return the key if the localization is not found instead of the searched key?
_localizer["This is a localize text"]
to
This is a localize text
instead of
SharedResource.This is a localize text.en-US
This would be extremely useful in View to have default text which tremendously reduce the database records which has all the default localize text.
Perhaps an options which consist one of the below