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

Pass studio strings into validation to allow for localization #35282

Merged
merged 2 commits into from
Jul 10, 2020

Conversation

bethanyaconnor
Copy link
Contributor

@bethanyaconnor bethanyaconnor commented Jun 11, 2020

This allows Playlab levels to access the studio i18n strings in validation code.

There are only a handful of levels whose validation is locale-specific. As far as I could find, these levels use the "say" block. The strings for the say block are in i18n/studio/en_us.json already, so those can be reused. This isn't the cleanest solution, but is low-risk and will solve for the ~11 levels that need to be updated.

I'll update the levels in Levelbuilder after this PR gets there.

Links

Testing story

Reviewer Checklist:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@bethanyaconnor bethanyaconnor requested a review from a team June 22, 2020 17:36
@@ -6983,9 +6983,11 @@ var checkFinished = function() {
var hasSuccessCondition =
level.goal && level.goal.successCondition ? true : false;
var achievedOptionalSuccessCondition =
!hasSuccessCondition || utils.valueOr(level.goal.successCondition(), true);
!hasSuccessCondition ||
utils.valueOr(level.goal.successCondition(studioMsg), true);
Copy link
Member

@daynew daynew Jun 29, 2020

Choose a reason for hiding this comment

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

This seems like a simple solution to the problem you described, but I'm have trouble figuring out how all these pieces fit together. Could you help me understand?

studioMsg is all the translated strings, right? If so, why do we need to pass all the translated strings into this function? Why can't the implementation of successCondition currently access our translated strings?

I also don't understand where the successConfition function is defined which will make use of the translated screens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

successCondition is an attribute of a level that contains a small javascript function that checks for "success".

For example, this level checks that a certain sprite says a certain phrase.
Screenshot 2020-06-30 at 10 20 54 AM

I couldn't get that function to access the translated strings on its own and I'm concerned about that being a sharp corner if we ever changed how files access the localized strings. We might forget to change these levels too.

Does that help?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After this change, the strings can be accessed like:
Screenshot 2020-06-30 at 10 28 40 AM

@bethanyaconnor
Copy link
Contributor Author

@daynew did I answer your question or do you have any other concerns?

@bethanyaconnor bethanyaconnor merged commit 8769221 into staging Jul 10, 2020
@bethanyaconnor bethanyaconnor deleted the non-en-level-validation branch July 10, 2020 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants