Skip to content

Commit ac5da59

Browse files
authored
Merge pull request #4975 from myk002/myk_translate
[Translation] default inEnglish to false to match Lua API
2 parents 32ed4f6 + e5324e3 commit ac5da59

10 files changed

Lines changed: 15 additions & 15 deletions

File tree

docs/dev/Lua API.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ can be omitted.
947947

948948
* ``dfhack.TranslateName(name[,in_english[,only_last_name]])``
949949

950-
Convert a language_name or only the last name part to string.
950+
Convert a ``df.language_name`` (or only the last name part) to string.
951951

952952
* ``dfhack.df2utf(string)``
953953

library/include/modules/Translation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ DFHACK_EXPORT void setNickname(df::language_name *name, std::string nick);
5656
DFHACK_EXPORT std::string capitalize(const std::string &str, bool all_words = false);
5757

5858
// translate a name using the loaded dictionaries
59-
DFHACK_EXPORT std::string TranslateName (const df::language_name * name, bool inEnglish = true,
59+
DFHACK_EXPORT std::string TranslateName (const df::language_name * name, bool inEnglish = false,
6060
bool onlyLastPart = false);
6161
}
6262
}

library/modules/Items.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,8 @@ static string get_base_desc(df::item *item) {
709709
if (auto name = Items::getBookTitle(item); !name.empty())
710710
return name;
711711
if (auto artifact = get_artifact(item); artifact && artifact->name.has_name)
712-
return Translation::TranslateName(&artifact->name, false) +
713-
", " + Translation::TranslateName(&artifact->name) +
712+
return Translation::TranslateName(&artifact->name) +
713+
", " + Translation::TranslateName(&artifact->name, true) +
714714
" (" + get_item_type_str(item) + ")";
715715
return Items::getDescription(item, 0, true);
716716
}

library/modules/Units.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ string Units::getReadableName(df::historical_figure *hf) {
11311131
prof_name = "Ghostly " + prof_name;
11321132
}
11331133

1134-
string name = Translation::TranslateName(getVisibleName(hf), false);
1134+
string name = Translation::TranslateName(getVisibleName(hf));
11351135
return name.empty() ? prof_name : name + ", " + prof_name;
11361136
}
11371137

@@ -1154,7 +1154,7 @@ string Units::getReadableName(df::unit *unit) {
11541154
if (isTame(unit))
11551155
prof_name += " (" + getTameTag(unit) + ")";
11561156

1157-
string name = Translation::TranslateName(getVisibleName(unit), false);
1157+
string name = Translation::TranslateName(getVisibleName(unit));
11581158
return name.empty() ? prof_name : name + ", " + prof_name;
11591159
}
11601160

@@ -1676,7 +1676,7 @@ static string get_land_title(Units::NoblePosition *np)
16761676
if (site_link->flags.bits.land_for_holding && site_link->position_profile_id == np->assignment->id)
16771677
{
16781678
auto site = df::world_site::find(site_link->target);
1679-
return site ? " of " + Translation::TranslateName(&site->name) : "";
1679+
return site ? " of " + Translation::TranslateName(&site->name, true) : "";
16801680
}
16811681
return "";
16821682
}

plugins/autoslab.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static void checkslabs(color_ostream &out)
174174
)
175175
{
176176
createSlabJob(ghost);
177-
auto fullName = Translation::TranslateName(&ghost->name, false);
177+
auto fullName = Translation::TranslateName(&ghost->name);
178178
out.print("Added slab order for ghost %s\n", fullName.c_str());
179179
}
180180
}

plugins/cleanowned.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ command_result df_cleanowned (color_ostream &out, vector <string> & parameters)
168168
df::unit *owner = Items::getOwner(item);
169169

170170
if (owner)
171-
out.print(", owner %s", DF2CONSOLE(Translation::TranslateName(&owner->name,false)).c_str());
171+
out.print(", owner %s", DF2CONSOLE(Translation::TranslateName(&owner->name)).c_str());
172172

173173
if (!dry_run)
174174
{

plugins/remotefortressreader/remotefortressreader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ static command_result GetUnitListInside(color_ostream &stream, const BlockReques
16971697
size_info->set_length_base(unit->body.size_info.length_base);
16981698
if (unit->name.has_name)
16991699
{
1700-
send_unit->set_name(DF2UTF(Translation::TranslateName(Units::getVisibleName(unit))));
1700+
send_unit->set_name(DF2UTF(Translation::TranslateName(Units::getVisibleName(unit), true)));
17011701
}
17021702

17031703
auto appearance = send_unit->mutable_appearance();

plugins/showmood.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ command_result df_showmood (color_ostream &out, vector <string> & parameters)
6969
out.printerr("Dwarf with strange mood does not have a mood type!\n");
7070
continue;
7171
}
72-
out.print("%s is currently ", DF2CONSOLE(out, Translation::TranslateName(&unit->name, false)).c_str());
72+
out.print("%s is currently ", DF2CONSOLE(out, Translation::TranslateName(&unit->name)).c_str());
7373
switch (unit->mood)
7474
{
7575
case mood_type::Macabre:

plugins/strangemood.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
548548
if (unit->job.current_job)
549549
{
550550
// TODO: cancel job
551-
out.printerr("Chosen unit '%s' has active job, cannot start mood!\n", Translation::TranslateName(&unit->name, false).c_str());
551+
out.printerr("Chosen unit '%s' has active job, cannot start mood!\n", Translation::TranslateName(&unit->name).c_str());
552552
return CR_FAILURE;
553553
}
554554

plugins/tailor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ class Tailor {
313313
{
314314
DEBUG(cycle).print ("tailor: %s (size %d) worn by %s (size %d) needs replacement\n",
315315
DF2CONSOLE(description).c_str(), isize,
316-
DF2CONSOLE(Translation::TranslateName(&u->name, false)).c_str(), usize);
316+
DF2CONSOLE(Translation::TranslateName(&u->name)).c_str(), usize);
317317
needed[std::make_pair(ty, usize)] += 1;
318318
ordered.insert(ty);
319319
}
@@ -329,7 +329,7 @@ class Tailor {
329329
"tailor: %s %s from %s.\n",
330330
(confiscated ? "confiscated" : "could not confiscate"),
331331
DF2CONSOLE(description).c_str(),
332-
DF2CONSOLE(Translation::TranslateName(&u->name, false)).c_str()
332+
DF2CONSOLE(Translation::TranslateName(&u->name)).c_str()
333333
);
334334
}
335335

@@ -346,7 +346,7 @@ class Tailor {
346346
TRACE(cycle).print("tailor: one %s of size %d needed to cover %s\n",
347347
ENUM_KEY_STR(item_type, ty).c_str(),
348348
usize,
349-
DF2CONSOLE(Translation::TranslateName(&u->name, false)).c_str());
349+
DF2CONSOLE(Translation::TranslateName(&u->name)).c_str());
350350
needed[std::make_pair(ty, usize)] += 1;
351351
}
352352
}

0 commit comments

Comments
 (0)