public static string GetTranslationDefaultMayNotBeEnglish(string key, string defaultCurrent)
{
string translation;
if (LocalizationManager.GetIsStringAvailableForLangId(key, LocalizationManager.UILanguageId))
{
// If we HAVE the string in the desired localization, we don't need
// a default and can just return the localized string; not passing a default ensures that
// even in English we get the true English string for this ID from the TMX.
translation = LocalizationManager.GetDynamicString("Bloom", key, null);
}
else
{
// Don't report missing strings if they are numbers
// Enhance: We might get the Javascript to do locale specific numbers someday
// The C# side doesn't currently have the smarts to do DigitSubstitution
// See Remark at https://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.digitsubstitution(v=vs.110).aspx
if (IsInteger(key))
{
translation = key;
}
else
{
// We don't have the string in the desired localization, so will return the English.
translation = LocalizationManager.GetDynamicStringOrEnglish("Bloom", key, null, null, "en");
// If somehow we don't have even an English version of it, keep whatever was in the element
// to begin with.
if (string.IsNullOrWhiteSpace(translation))
{
translation = defaultCurrent;
ReportL10NMissingString(key, translation);
}
}
}
return translation;
}