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

Translate item category names on the fly #26656

Merged
merged 2 commits into from
Nov 15, 2018

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Nov 12, 2018

Summary

SUMMARY: Bugfixes "Fix item category names not updated when switching the language"

Purpose of change

Translate item category names on the fly so they're correctly updated when switching the language.

Describe the solution

Store a translation object instead of a translated string in item_category. The inventory UI is using pseudo categories with composed names to represent item locations, which need no further translation, so these categories are constructed with no_translation().

Also updated JSON_INFO.md.

Additional context

Should really remove the pseudo category hack and replace it with some proper wrapper, but that's out of the scope of this PR.

@ZhilkinSerg ZhilkinSerg added <Documentation> Design documents, internal info, guides and help. Translation I18n [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) [Markdown] Markdown issues and PRs labels Nov 12, 2018
}
return id_ < rhs.id_;
}

bool item_category::operator==( const item_category &rhs ) const
{
return sort_rank_ == rhs.sort_rank_ && name_ == rhs.name_ && id_ == rhs.id_;
return sort_rank_ == rhs.sort_rank_ && name() == rhs.name() && id_ == rhs.id_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to have this comparison logic (as well as the relational operator as used above) as part of the translation class, so one does not have to update each piece of code that is converted to use this type.

@kevingranade kevingranade merged commit a372021 into CleverRaven:master Nov 15, 2018
@Qrox Qrox deleted the item-category-translation branch November 18, 2018 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` <Documentation> Design documents, internal info, guides and help. [Markdown] Markdown issues and PRs Translation I18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants