From c4ca26c01316279f5911ae202ae23a47d6e731dd Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 14 Dec 2019 23:19:58 +0100 Subject: [PATCH] Fix compatibility with Godot 3.1 This closes #35. --- Scripts/Main.gd | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Scripts/Main.gd b/Scripts/Main.gd index 3fea8a73e..adfa01291 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -24,8 +24,15 @@ func _ready() -> void: # This property is only available in 3.2alpha or later, so use `set()` to fail gracefully if it doesn't exist. OS.set("min_window_size", Vector2(1152, 648)) + # `TranslationServer.get_loaded_locales()` was added in 3.2beta and isn't available in 3.1.2. + # The `has_method()` check and the `else` branch can be removed once 3.2 is released. + if TranslationServer.has_method("get_loaded_locales"): + loaded_locales = TranslationServer.get_loaded_locales() + else: + # Hardcoded list of locales + loaded_locales = ["el", "en"] + # Make sure locales are always sorted, in the same order - loaded_locales = TranslationServer.get_loaded_locales() loaded_locales.sort() # Load settings from the config file