You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Implement OS::get_locale_language() helper method
This method extracts the 2 or 3-letter language code from `OS::get_locale()`, making it easier for users to identify the "main" language code for users that might have different OS locales due to different OS or region, but should be matched to the same translation (e.g. "generic" Spanish). Fixes #40703.
This commit is contained in:
@@ -231,6 +231,12 @@ String OS::get_locale() const {
|
||||
return "en";
|
||||
}
|
||||
|
||||
// Non-virtual helper to extract the 2 or 3-letter language code from
|
||||
// `get_locale()` in a way that's consistent for all platforms.
|
||||
String OS::get_locale_language() const {
|
||||
return get_locale().left(3).replace("_", "");
|
||||
}
|
||||
|
||||
// Helper function to ensure that a dir name/path will be valid on the OS
|
||||
String OS::get_safe_dir_name(const String &p_dir_name, bool p_allow_dir_separator) const {
|
||||
Vector<String> invalid_chars = String(": * ? \" < > |").split(" ");
|
||||
|
||||
Reference in New Issue
Block a user