AI OnAI Off
In the end I just implemented my own ProviderBasedLocalizationService, and overrided the GetStringByCulture method to do what I wanted - namely, to remove the logic to get the actual fallback culture from the invariant culture of the requested language.
Hi Everyone,
I'm currently looking into providing multiple fallback languages (based on the fallback languages configured per page in EPiServer CMS) when retrieving translate labels from the localization service.
The idea was to get the fallbacks for the current page, and effectively "test" to see if a label was available in a given fallback language - if it isn't, try the next one, and so on.
The problem I have is that when making a call such as this one:
var labelInLanguage = LocalizationProvider.Current.GetStringByCulture(label, language);
Inside GetStringByCulture in the localization service I see:
GetActualFallbackCulture will give me the invariant culture for my culture I've provided - in trying to get a string for en-US it will provide me with an EN culture and use this in the TrygetStringByCulture call just below it.
So it seems like I will always get a value back from the localization service regardless of if I specify no fallbacks in the provider.
The above logic looks inevitable no matter what localization configuration I use, which means I'd have no way to know if the fallback language I've provided has an actual localized label, or if its the result of the invariant culture being used.
Any help or insight is much appreciated!
Thanks,
Paul