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

Fix more translation and translation updating issues #33433

Merged
merged 14 commits into from
Aug 25, 2019

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Aug 21, 2019

Summary

SUMMARY: Bugfixes "Fix more translation and translation updating issues"

Purpose of change

Fixed text with updating problems when switching language
Skill names
Bionic names/descriptions
Recipe category names
Terrain bash sound descriptions
Vehicle part names
Text snippets
Fixed untranslated text
Trap-vehicle collision sound descriptions
A non-combustion engine starting message in activityhandlers.cpp

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 use translation.

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.

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" ) ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bionic_data::bionic_data() : name( translation( "bad bionic" ) ),
bionic_data::bionic_data() : name( "bad bionic" ),

Same for the other member.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@ZhilkinSerg ZhilkinSerg added <Documentation> Design documents, internal info, guides and help. [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs Translation I18n labels Aug 21, 2019
@ZhilkinSerg ZhilkinSerg self-assigned this Aug 24, 2019
@ZhilkinSerg ZhilkinSerg merged commit 60e0ca9 into CleverRaven:master Aug 25, 2019
@ZhilkinSerg ZhilkinSerg removed their assignment Aug 25, 2019
@Qrox Qrox deleted the fix-translation branch August 29, 2019 01:26
misterprimus pushed a commit to misterprimus/Cataclysm-DDA that referenced this pull request Sep 21, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[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.

3 participants