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

Merged
merged 1 commit into from
Nov 22, 2024

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
@dbnicholson dbnicholson force-pushed the standardize-add-defaults branch from 5e13843 to a71dad5 Compare November 12, 2024 13:00
@dbnicholson dbnicholson requested review from a team as code owners November 12, 2024 13:00
@dbnicholson dbnicholson force-pushed the standardize-add-defaults branch from a71dad5 to 02a776b Compare November 12, 2024 16:17
@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.

@dbnicholson
Copy link
Contributor Author

@bruvzg could I get another review? Thanks!

@dbnicholson dbnicholson force-pushed the standardize-add-defaults branch 2 times, most recently from 95db239 to 6930f0a Compare November 19, 2024 19:14
Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

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

The remark about the new argument is completely fine

@akien-mga akien-mga modified the milestones: 4.x, 4.4 Nov 21, 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.
@dbnicholson dbnicholson force-pushed the standardize-add-defaults branch from 6930f0a to 6f4fadf Compare November 21, 2024 23:50
@Repiteo Repiteo merged commit f952bfe into godotengine:master Nov 22, 2024
19 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 22, 2024

Thanks!

@dbnicholson dbnicholson deleted the standardize-add-defaults branch November 22, 2024 18:09
@astratgeovendi01

This comment was marked as spam.

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
8 participants