-
-
Notifications
You must be signed in to change notification settings - Fork 110
feat(core): add support for formattable variant prefixes #626
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
base: release/v2.12.0
Are you sure you want to change the base?
feat(core): add support for formattable variant prefixes #626
Conversation
I would suggest something like this, but @Haato3o will have a better idea of how he wants to do this.
|
I did originally think we'd need to support multiple prefixes, but couldn't find anything to confirm if it's possible to have, say, "Tempered Frenzied {{monster}}". If that is the case though, I do like your suggestion. Edit: Gave this some more thought, and I think building a list would require a little extra work to handle in the context of ordering things correctly based on language. If we assume the localization text looks like this: <Monsters>
<Variants>
<Variant Id="TEMPERED"
String="{0} (歴戦の個体)" />
<Variant Id="ARCH_TEMPERED"
String="歴戦王{0}" />
<Variant Id="FRENZIED"
String="狂竜化{0}" />
</Variants>
<!-- ... -->
</Monsters> We'd build a list of multiple prefixes that's basically |
That just a basic example, you can try making it so if the variants contains a {0} placeholder for the monster name, format can be used to replace it with the monster name. Similar to what you did in original PR. |
I think since there are two PRs for the same thing, we should keep the discussion in the issue that suggested this (#623) |
uses regex to process format string
little more descriptive, makes comment redundant
to be variant followed by name
- including GetLocalizedVariantString
allows variant flag to be treated as sub-variant
Why would we need each combination of formattings? This doesn't seem like something that would scale well if they add more sub-variants 🤔 |
Hi, I was interested in this topic and wanted to weigh in an opinion on how this feature could be approached. Rather than impose a combination of formatting, you could treat each variant/sub-variant etc. as a tag, and in the localization xml you would give each tag attributes declaring whether it's a prefix or suffix and an order of priority (e.g. should it always be added first etc.) So the file itself can look something like the below: <Monsters>
<Variants>
<Variant Id="TEMPERED"
String="(歴戦の個体)"
Affixation="Suffix"
Order="0"/>
<Variant Id="ARCH_TEMPERED"
String="歴戦王"
Affixation="Prefix"
Order="2" />
<Variant Id="FRENZIED"
String="狂竜化"
Affixation="Prefix"
Order="1"/>
<Variant Id="ALPHA"
String="α"
Affixation="Prefix"
Order="0" />
</Variants>
<!-- ... -->
<Monsters> As far as I can tell, the problem seems to be of two kinds:
Doing it in the above way means in the c# code we can build the prefix and suffix separately and then just attach it to the monster name |
I think I've misunderstood the suggestion made in the issue. I took it to mean that we'd want a format string for any possible variant or combination of variants, to determine the order of things in different localisations. @Lucarine please do feel free to open up a PR if you'd like, I've gotten crazy busy at work so no issues if someone wants to take over implementing a solution to this so I'm not holding it up with my slow contributions 😅 |
Changes
BuildName
method to support format/template strings from localization filesThe intention with this change is to allow the localization file to dictate the formatting for monster variant prefixes, as detailed in #623.
This is my first time working with C# so please do point out if I'm doing anything crazy.
Implementation Details
The changes here update
BuildName
such that:{0}
), useAppendFormat
to build the name string based on the localized string template.<variant><name>
formatting, using the English variant text.With these changes updating a respective localization file to include, for example:
Should then allow monster names to be rendered with whatever variant prefix formatting makes the most sense for that locale.
Screenshots
Monster names with variants, if no variant data exists in localization file.

Monster names with variants, if variant data does exist in localization file.
