Skip to content

Commit

Permalink
Fix wrong usage of string_format() and _() (#71847)
Browse files Browse the repository at this point in the history
* Fix wrong usage of string_format() and _()

* Add context in variant description translation

Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>

---------

Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>
  • Loading branch information
BrettDong and Qrox authored Feb 19, 2024
1 parent 787759e commit cb5cceb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/clzones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ std::string unload_options::get_zone_name_suggestion() const
return string_format( "%s%s%s%s%s", _( "Unload: " ),
mods ? _( "mods, " ) : "",
molle ? _( "MOLLE, " ) : "",
sparse_only ? _( string_format( "ignore stacks over %i, ", sparse_threshold ) ) : "",
sparse_only ? string_format( _( "ignore stacks over %i, " ), sparse_threshold ) : "",
always_unload ? _( "unload all" ) : _( "unload unmatched" ) );
}

Expand Down Expand Up @@ -485,7 +485,7 @@ std::vector<std::pair<std::string, std::string>> unload_options::get_description
string_format( "%s%s%s%s",
mods ? _( "mods " ) : "",
molle ? _( "MOLLE " ) : "",
sparse_only ? _( string_format( "ignore stacks over %i, ", sparse_threshold ) ) : "",
sparse_only ? string_format( _( "ignore stacks over %i, " ), sparse_threshold ) : "",
always_unload ? _( "unload all" ) : _( "unload unmatched" ) ) );

return options;
Expand Down
4 changes: 2 additions & 2 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9297,8 +9297,8 @@ std::string item::variant_description() const

// append the description instead of fully overwriting it
if( itype_variant().append ) {
return _( string_format( "%s %s", type->description.translated(),
itype_variant().alt_description.translated() ) );
return string_format( pgettext( "variant description", "%s %s" ), type->description.translated(),
itype_variant().alt_description.translated() );
} else {
return itype_variant().alt_description.translated();
}
Expand Down
2 changes: 1 addition & 1 deletion src/newcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@ static std::string assemble_profession_details( const avatar &u, const input_con
assembled += "\n";
}
if( !prof_ma_choices.empty() ) {
assembled += colorize( _( string_format( "Choose %s:", ma_amount ) ), c_cyan ) + "\n";
assembled += colorize( string_format( _( "Choose %d:" ), ma_amount ), c_cyan ) + "\n";
for( const matype_id &ma : prof_ma_choices ) {
const martialart &style = ma.obj();
assembled += style.name.translated() + "\n";
Expand Down

0 comments on commit cb5cceb

Please sign in to comment.