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

findAvailableLocale refactor - Removed the static function from the API and added a member function #3245

Merged
merged 4 commits into from
Jul 1, 2021

Conversation

yaustar
Copy link
Contributor

@yaustar yaustar commented Jun 17, 2021

Fixes https://forum.playcanvas.com/t/playcanvas-api-function-not-working/20738

I can't think why this was public as static function as the only way to use it would be to access private member properties on i18n.

Added a member version of the function that checks against loaded translations.

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

@yaustar yaustar requested a review from a team June 17, 2021 10:09
@yaustar yaustar self-assigned this Jun 17, 2021
src/i18n/i18n.js Outdated Show resolved Hide resolved
@yaustar yaustar added the release: next minor Ticket marked for the next minor release label Jun 17, 2021
@yaustar yaustar requested a review from vkalpias June 23, 2021 12:34
@yaustar yaustar requested a review from mvaligursky June 23, 2021 12:50
@vkalpias
Copy link
Contributor

You should add some tests for this in tests/i18n/test_i18n.js.

@yaustar
Copy link
Contributor Author

yaustar commented Jun 24, 2021

@vkalpias Added tests :)

expect(app.i18n.findAvailableLocale('no-IT')).to.equal('no-IT');
});

it('findAvailableLocale() should fallback to en-US if translations have not been provide for the desired locale', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
it('findAvailableLocale() should fallback to en-US if translations have not been provide for the desired locale', function () {
it('findAvailableLocale() should fallback to en-US if translations have not been provided for the desired locale', function () {

@yaustar yaustar merged commit c615c56 into master Jul 1, 2021
@yaustar yaustar deleted the findAvailableLocale-refactor branch July 1, 2021 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: localisation release: next minor Ticket marked for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants