-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix more translation and translation updating issues #33433
Conversation
…g from other objects
src/bionics.cpp
Outdated
@@ -147,10 +147,9 @@ bool bionic_data::is_included( const bionic_id &id ) const | |||
return std::find( included_bionics.begin(), included_bionics.end(), id ) != included_bionics.end(); | |||
} | |||
|
|||
bionic_data::bionic_data() | |||
bionic_data::bionic_data() : name( translation( "bad bionic" ) ), |
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.
bionic_data::bionic_data() : name( translation( "bad bionic" ) ), | |
bionic_data::bionic_data() : name( "bad bionic" ), |
Same for the other member.
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.
It is necessary for extracting the strings for translation.
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.
Do those strings really need to be translatable? They should never appear, and if they appear it indicates a bug and should stand out.
Anyway, if you keep it as it is now, you should add a comment. Otherwise someone might remove it as it appears to be redundant.
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.
Alright, I made it no_translation
so it will properly ignore the string during translation and not appear redundant.
* Fix translation update - skill names * Fix translation update - bionic names/descriptions * Remove some explicit `translated` calls * Fix translation update - recipe category names * Fix translation update - terrain bash sound descriptions * Fix translation - trap-vehicle collision sound description * Convert .pot file line endings to Unix on Windows * Suppress warning when nothing translatable is found in objects copying from other objects * Update translation documentation * Mark a string for translation * Fix translation update - vehicle part names * Fix translation update - text snippets * Update translation documentation * Use no_translation for debug text
Summary
SUMMARY: Bugfixes "Fix more translation and translation updating issues"
Purpose of change
Describe the solution
Used
translation
class for most of the fixed text except recipe category names and text snippets: recipe category was translating the unprefixed category id to category name, and I didn't change it. Text snippets was using string hash as indices to the snippets, and I decided it was too much hassle to change it to usetranslation
.The hash of a text snippet is now computed using the untranslated text, to ensure the snippets are properly loaded when opening the game with a different language.
The CBM name parameters in bionic installation/uninstallation activity is now deprecated, and the names are retrieved using bionic id instead. This ensures that the bionic name is always updated if the language is changed before the activity ends.
The trap-vehicle collision sound descriptions are now extracted for translation. I also updated the string extraction scripts to output Unix line endings on Windows, as
msgmerge
occassionally glitches and gobbles a character at line start if the .pot file and .po files have different line endings. Also suppressed the warning about nothing translatable in json objects if the object contains "copy-from" values, since it's entirely plausible for objects using "copy-from" to not specify any overriding text.The translation documentation is also updated to reflect the changes.
Additional context
I'm not sure if the currently used hash function for indexing text snippets is suitable for indexing purposes, since it uses a simple shfit-and-add algorithm. If there are hash clashes, weird sh*t might happen. But if it needs fixing, it is beyond the scope of this PR.