From 76db87f9cb273ca92e7cf61fc7faef898d74712a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 19 Jun 2021 08:00:36 +0200 Subject: [PATCH 1/3] Try-catch around localisation store registration Some platforms (android, older windows versions) will throw exceptions at runtime when an unsupported `CultureInfo` is attempted to be instantiated, leading to nasty crashes. Add a preventative try-catch registration to prevent the crash, and log the errors for visibility. --- osu.Game/OsuGame.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 0c4d035728..7455df361c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -55,6 +55,7 @@ using osu.Game.IO; using osu.Game.Localisation; using osu.Game.Performance; using osu.Game.Skinning.Editor; +using osu.Framework.Extensions; namespace osu.Game { @@ -585,7 +586,15 @@ namespace osu.Game foreach (var language in Enum.GetValues(typeof(Language)).OfType()) { var cultureCode = language.ToCultureCode(); - Localisation.AddLanguage(cultureCode, new ResourceManagerLocalisationStore(cultureCode)); + + try + { + 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 From b47774b55a4d146e4d5a24a8daeafbde2f551cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 19 Jun 2021 08:07:37 +0200 Subject: [PATCH 2/3] Remove Tagalog language for now Rationale given in inline comment. --- osu.Game/Localisation/Language.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Localisation/Language.cs b/osu.Game/Localisation/Language.cs index 65541feedf..3c66f31c58 100644 --- a/osu.Game/Localisation/Language.cs +++ b/osu.Game/Localisation/Language.cs @@ -86,8 +86,10 @@ namespace osu.Game.Localisation [Description(@"ไทย")] th, - [Description(@"Tagalog")] - tl, + // Tagalog has no associated localisations yet, and is not supported on Xamarin platforms or Windows versions <10. + // Can be revisited if localisations ever arrive. + //[Description(@"Tagalog")] + //tl, [Description(@"Türkçe")] tr, From afcc3e14f436d0e413bf5e6dfa0cdca844f6956d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 19 Jun 2021 16:16:29 +0900 Subject: [PATCH 3/3] m --- osu.Game/OsuGame.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7455df361c..d7cdb8b396 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -55,7 +55,6 @@ using osu.Game.IO; using osu.Game.Localisation; using osu.Game.Performance; using osu.Game.Skinning.Editor; -using osu.Framework.Extensions; namespace osu.Game {