-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add tables to facilitate translation of weapontypes and categories #463
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
Open
LordMidas
wants to merge
5
commits into
development
Choose a base branch
from
feat-extract-category-keys-for-weapon-type
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e41f6a0
feat: add tables to facilitate translation of weapontypes and categories
LordMidas 258d522
fix: push weapon type name to the strings array in adding new weapontype
LordMidas f15d381
refactor: create WeaponTypeCategoriesStrings using WeaponTypeName
LordMidas 958721a
fix: trying to call function before declaration
LordMidas 587afc5
fix: add the english strings manually to the categories strings table
LordMidas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see 3 issues with this implementation:
this.m.Categories = "Throwing/Crossbow/Bow, Two-Handed";and Barbarian Drum in Legends hasthis.m.Categories = "Musical, Staff, Two-Handed";Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildCategoriesFromWeaponTypeit puts the name there i.e.getWeaponTypeName()and not any other representation string e.g.Throwing. Therefore, to keep things consistent, if someone defines Categories manually and wants WeaponType to be assigned based on that then these strings in the Categories should be WeaponTypeName. So one is not expected to putThrowing/Crossbow/Bowbut rather it should beThrowing Weapon/Crossbow/Bow.However, your point is valid that this changes behavior. Previously
Throwingin Categories was enough and now it will requireThrowing Weapon. I don't know if this should be considered a fix of behavior or change.I think my first paragraph above is relevant for this. There is no concept of "Representation strings", but rather it should be that the string that
buildCategoriesFromWeaponTypeputs inm.Categorieswhen building categories automatically from defined WeaponTypes should be the same string thatbuildWeaponTypeFromCategoriesdetects when building WeaponType from defined Categories. This table is created at the start and is static, so translators can simply push to this table, no?I did not understand this point, could you elaborate please? It's meant to be an array that people can just push to.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the try to extract One-Handed and Two-Handed. Not sure this would be useful for anyone though. For the guys translating strings inplace it will make it worse, i.e. they will translate it and loose matching for english or not translate and then they will be left as is. For Rosetta it just doesn't matter.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's say that a certain WeaponType has a different "string" in the matching than its
WeaponTypeName. Let's say this WeaponType is calledThrowing. It's matching string isThrowingbut its WeaponTypeName is changed toJumping Weapon.Now consider this situation:
buildCategoriesFromWeaponType. When this is used MSU usesgetWeaponTypeName()to generate them.Categoriesstring.addWeaponType(::Const.Items.WeaponType.Throwing).Jumping Weaponto them.Categoriesstring.this.m.WeaponType.buildWeaponTypeFromCategoriesto rebuild the WeaponType.Throwing.. but because of the function above, MSU already putJumping Weaponin the Categories. So it doesn't get matched, and the WeaponType isn't correctly assigned.Therefore, in my opinion, it is essential that the two strings are not different i.e. the string that
buildCategoriesFromWeaponTypeputs inm.Categoriesshould exactly match the string thatbuildWeaponTypeFromCategoriesexpects to be there. And because the former function usesgetWeaponTypeName()the latter also has to use the same as the detection string.However, we allow translators to push new strings for WeaponTypeName into the
WeaponTypeCategoriesStringstable's arrays. This basically makes thebuildWeaponTypeFromCategoriesfunction to detect both the originalgetWeaponTypeName()i.e. the English hard-coded one and the one from translators (as long as they are modifying theWeaponTypeNametable in a hook that runs after MSU and are not overwriting MSU files).In summary:
The translators should queue after MSU and do the following:
getWeaponTypeName().buildWeaponTypeFromCategories.What are your thoughts about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first thought is that this is overcomplicated, same as this implementation. Second one - is it even supposed by anyone to call these build* functions or clear weaponType? Because if someone starts to do such things your code will break anyway because you initWeaponType once.
So certain symmetry between matching and representation strings might be needed, like ones included into another so that statically translated weapons will work properly. But that's it and it should be translator responsibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So actually representation is only for One/Two-Handed. And pushing to the end of the arrays will work for both, even if that feels awkward. If pushing more than one item to those will need to be sure to push the canonical one later.
For weapon types there is no clash, representation strings go to
::Const.Items.WeaponTypeNameand matching strings to this new nested structure.Still using a flat table {string = type} makes more sense to me. And One/Two-Handed is not even a weapon types, so I would just use a separate thing for those. Will make for simpler code.