[TASK-1083] Add utils for determining MMO labeling #5194
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
./python-format.sh
to make sure that your code lints and that you've followed our coding styleDescription
Adds two helper utils for determining whether an MMO should be referred to as an 'organization' or as a 'team'. One of the utils returns a translated string, with options for plural and capitalization.
Notes
I felt it would be unnecessarily complex to add in the potential for possessive case, so I also abstracted and exported a more simplistic util that just determines which term should be used. So if someone needs possessive case or they will use the label multiple times in a string they can just write out two separate translated strings themselves and use the util to pick which one to return.
Also note that this is may be merged ahead of the backend work for this feature: #5182. I have set the upcoming "use_team_label" field in the envStore as optional for the time being. We will want to remove that once the backend work is merged. But it should not have any impact on current functioning of the frontend.
Testing
Testing may be more hassle than it is worth for this. I'd recommend just double-checking my logic. But if you would like to test, 'yourPlan.component.tsx' already imports both the envStore and subscription context. You can import these functions there and console log the results before and after subscribing to an enterprise plan, for example.