Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose TranslationServer::standardize_locale add_default param publicly #98972

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dbnicholson
Copy link
Contributor

@dbnicholson dbnicholson commented Nov 8, 2024

Comparing locales can have surprising outcomes since it standardizes locales with defaults. For example, zh and zh_CN result in an exact match since the defaults change them both to zh_Hans_CN. Expose the add_default parameter publicly with a default of false so the fully standardized locale can be inspected.

Closes: godotengine/godot-proposals#11119

@dbnicholson dbnicholson requested review from a team as code owners November 8, 2024 17:52
@AThousandShips AThousandShips added this to the 4.x milestone Nov 8, 2024
@adamscott adamscott changed the title Expose standardize_locale add_default param publicly Expose TranslationServer::standardize_locale add_default param publicly Nov 8, 2024
Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exposing it seems fine.

core/string/translation_server.cpp Show resolved Hide resolved
Comparing locales can have surprising outcomes since it standardizes
locales with defaults. For example, zh and zh_CN result in an exact
match since the defaults change them both to zh_Hans_CN. Expose the
add_default parameter publicly with a default of false so the fully
standardized locale can be inspected.
@dbnicholson
Copy link
Contributor Author

I rebased and fixed up the conflict from #98743.

@@ -52,10 +52,14 @@ class TranslationServer : public Object {

static TranslationServer *singleton;
bool _load_translations(const String &p_from);
String _standardize_locale(const String &p_locale, bool p_add_defaults) const;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should actually have been part of #98743. I can split that out to a separate PR if that's preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose standardized locales with added defaults
4 participants