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

Migrate names to snippets & add weighted snippets #70279

Merged
merged 3 commits into from
Jan 4, 2024

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Dec 18, 2023

Summary

Infrastructure "Migrate names to snippets & add weighted snippets"

Purpose of change

Unify the name snippets to use the strings in names/*.json everywhere. This should also relieve translators of the burden of having to translate gazillions of names, and fixes #70023:

image
(Over 10k strings untranslated, of which several thousand are names...)

This also implements weighted snippets so that snippets can now have different probabilities to be chosen, which is used to generate full names with snippets.

Describe the solution

Migrate code from name.h/cpp to text_snippets.h/cpp, and update related cpp/json code to use the snippet library and unified name tags.

The second commit adds weighted snippets, which accepts a "weight" value along with the snippet "text", and the weight value is used when selecting random snippets from a category by considering all weight values in the same category.

Describe alternatives you've considered

Further migrate the name snippets to the normal snippet format, but the current format has the advantage of not requiring translations to have the same number of entries in the name list, which is not supported by the snippet format.

The removed names in dda and Mind Over Matter could be added to names/*.json maybe? @MNG-cataclysm @Standing-Storm what are your thoughts?

Testing

Tested creating worlds and characters, spawning NPCs and cities, and other related changes, and the names were generated correctly.

Additional context

I notice that the current snippets use <full_name> in multiple places, but <full_name> was actually expanded into the names of the crowdfunding donors, so I'd like some input on whether those are supposed to be any full name or only donor names.

The ~10000 deletion is mostly due to the removal of the snippet name lists.

@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership Info / User Interface Game - player communication, menus, etc. Translation I18n [JSON] Changes (can be) made in JSON Mods Issues related to mods or modding Missions Quests and missions Map / Mapgen Overmap, Mapgen, Map extras, Map display Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. Character / World Generation Issues and enhancements concerning stages of creating a character or a world Lore Game lore, in-game communication. Also the Lore tab. EOC: Effects On Condition Anything concerning Effects On Condition Mods: Mind Over Matter <Bugfix> This is a fix for a bug (or closes open issue) Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Dec 18, 2023
@Standing-Storm
Copy link
Contributor

Thank you for doing this. I was very surprised that <given_name> (etc) didn't work in dialogue.

The names in that file in MoM were the top 500 most common given and family names in Massachusetts in (I think) 1990, so they would fit DDA's setting if you wanted to migrate them.

@GuardianDll
Copy link
Member

GuardianDll commented Dec 29, 2023

Anything that stops us from merging this PR?

I'd like some input on whether those are supposed to be any full name or only donor names

i think it's fine to have donors names in full_name

@Qrox
Copy link
Contributor Author

Qrox commented Dec 29, 2023

Anything that stops us from merging this PR?

I haven't got the time to test this PR yet. I'll probably do it in a few days.

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Jan 1, 2024
@Qrox Qrox marked this pull request as ready for review January 1, 2024 14:09
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Auto-requesting reviews from non-collaborators: @Standing-Storm

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 1, 2024
src/text_snippets.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions and removed astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jan 1, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 2, 2024
@Qrox
Copy link
Contributor Author

Qrox commented Jan 2, 2024

The tests keep failing for unrelated reasons 🤷.

@Maleclypse Maleclypse merged commit f255964 into CleverRaven:master Jan 4, 2024
20 of 25 checks passed
@Qrox Qrox deleted the names branch January 8, 2024 07:29
Qrox added a commit to Qrox/Cataclysm-DDA that referenced this pull request Apr 17, 2024
Append names from the removed files into corresponding lists in names/en.json, sort the lists, and remove duplicate entries. The given names from MoM are not added, because they lack gender info required by the lists.
Qrox added a commit to Qrox/Cataclysm-DDA that referenced this pull request Apr 17, 2024
…0279

Family and given names from names/en.json are converted to translated names from the Japanese mo file before CleverRaven#70279 using a script. The translated names are then appended to lists in names/ja.json, sorted, and made unique. Translations that are not names are then removed. (They are easy to locate after sorting, because the Japanese translators translated names using half-width katakana exclusively.)
Qrox added a commit to Qrox/Cataclysm-DDA that referenced this pull request Apr 17, 2024
…verRaven#70279

Family and given names from names/en.json are converted to translated names from the Simplified Chinese mo file before CleverRaven#70279 using a script. The translated names are then appended to lists in names/zh_CN.json, sorted, and made unique. Translations that are not names are then removed manually.
Qrox added a commit to Qrox/Cataclysm-DDA that referenced this pull request Apr 17, 2024
…en#70279

Family and given names from names/en.json are converted to translated names from the Russian mo file before CleverRaven#70279 using a script. The translated names are then appended to lists in names/ru.json, sorted, and made unique.
Qrox added a commit to Qrox/Cataclysm-DDA that referenced this pull request Apr 21, 2024


Family and given names from names/en.json are converted to translated names from the Russian mo file before CleverRaven#70279 and added to names/ru.json using a script.
Maleclypse pushed a commit that referenced this pull request Aug 29, 2024
 (Help wanted with reviewing) (#73083)

* Add Russian names from translated name snippets before #70279

Family and given names from names/en.json are converted to translated names from the Russian mo file before #70279 and added to names/ru.json using a script.

* Fix some incorrectly translated Russian names, thanks Hyperseeker, Zireael07, and Vane79!

Co-authored-by: Steve Brand <[email protected]>

* Fix more incorrectly translated Russian names

* Fix more incorrectly translated Russian names, thanks Hyperseeker and Vane79!

Co-authored-by: Steve Brand <[email protected]>

* Update ru.json

* Fix more incorrectly translated Russian names

Co-authored-by: Steve Brand <[email protected]>

---------

Co-authored-by: Steve Brand <[email protected]>
Co-authored-by: Uwuewsky <[email protected]>
Knut-Aage-Hofseth pushed a commit to Knut-Aage-Hofseth/Cataclysm-DDA that referenced this pull request Aug 29, 2024
…verRaven#70279 (Help wanted with reviewing) (CleverRaven#73083)

* Add Russian names from translated name snippets before CleverRaven#70279

Family and given names from names/en.json are converted to translated names from the Russian mo file before CleverRaven#70279 and added to names/ru.json using a script.

* Fix some incorrectly translated Russian names, thanks Hyperseeker, Zireael07, and Vane79!

Co-authored-by: Steve Brand <[email protected]>

* Fix more incorrectly translated Russian names

* Fix more incorrectly translated Russian names, thanks Hyperseeker and Vane79!

Co-authored-by: Steve Brand <[email protected]>

* Update ru.json

* Fix more incorrectly translated Russian names

Co-authored-by: Steve Brand <[email protected]>

---------

Co-authored-by: Steve Brand <[email protected]>
Co-authored-by: Uwuewsky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Character / World Generation Issues and enhancements concerning stages of creating a character or a world Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Code: Tests Measurement, self-control, statistics, balancing. EOC: Effects On Condition Anything concerning Effects On Condition Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Lore Game lore, in-game communication. Also the Lore tab. Map / Mapgen Overmap, Mapgen, Map extras, Map display Missions Quests and missions Mods: Mind Over Matter Mods Issues related to mods or modding Monsters Monsters both friendly and unfriendly. Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies NPC / Factions NPCs, AI, Speech, Factions, Ownership Translation I18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translations for names share the same strings as others
4 participants