Merge pull request #13572 from bdach/fix-unsupported-locales

Fix game crashes due to attempting localisation load for unsupported locales
This commit is contained in:
Dean Herbert 2021-06-19 17:09:39 +09:00 committed by GitHub
commit b6e07ff59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -86,8 +86,10 @@ namespace osu.Game.Localisation
[Description(@"ไทย")] [Description(@"ไทย")]
th, th,
[Description(@"Tagalog")] // Tagalog has no associated localisations yet, and is not supported on Xamarin platforms or Windows versions <10.
tl, // Can be revisited if localisations ever arrive.
//[Description(@"Tagalog")]
//tl,
[Description(@"Türkçe")] [Description(@"Türkçe")]
tr, tr,

View File

@ -585,8 +585,16 @@ namespace osu.Game
foreach (var language in Enum.GetValues(typeof(Language)).OfType<Language>()) foreach (var language in Enum.GetValues(typeof(Language)).OfType<Language>())
{ {
var cultureCode = language.ToCultureCode(); var cultureCode = language.ToCultureCode();
try
{
Localisation.AddLanguage(cultureCode, new ResourceManagerLocalisationStore(cultureCode)); Localisation.AddLanguage(cultureCode, new ResourceManagerLocalisationStore(cultureCode));
} }
catch (Exception ex)
{
Logger.Error(ex, $"Could not load localisations for language \"{cultureCode}\"");
}
}
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results // The next time this is updated is in UpdateAfterChildren, which occurs too late and results
// in the cursor being shown for a few frames during the intro. // in the cursor being shown for a few frames during the intro.