Try our conversational search powered by Generative AI!

Let LocalizationService return FallbackCulture string before fallback string argument

Fixed in

EPiServer.CMS.Core 10.0.1

(Or a related package)

Created

Sep 16, 2015

Updated

Oct 27, 2016

Area

CMS Core

State

Closed, Fixed and tested


Description

If a system is configured to use FallbackCulture, it is likely that this value should be prioritized over a fallback string passed in as an argument. Because FallbackCulture usually would be a fixed string, such as the Class name of a ContentType, in which case the English translation would be a better option.

Breaking changes
Calling LocalizationService.GetString(string key, string fallback) or GetStringByCulture(string key, string fallback, CultureInfo culture) with a (null) fallback string now follows the defined fallback behavior. It also throws an exception instead of returning null if the resource key is null or empty.

To achieve behavior that matches the previous, remove the null fallback string and pass in the explicit fallback behavior of FallbackBehaviors.Null. Change GetString("key", (string)null) to GetString("key", FallbackBehaviors.Null)