1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Fix #22072: Localisation: Separate objective date string from staff tenure date string (#22074)

Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
This commit is contained in:
Arnold Zhou
2024-09-29 01:13:48 +10:00
committed by GitHub
parent ce7e501607
commit c161a3911a
7 changed files with 19 additions and 7 deletions

View File

@@ -1739,8 +1739,8 @@ STR_2382 :Land
STR_2383 :Water STR_2383 :Water
STR_2384 :{WINDOW_COLOUR_2}Your objective: STR_2384 :{WINDOW_COLOUR_2}Your objective:
STR_2385 :{BLACK}None STR_2385 :{BLACK}None
STR_2386 :{BLACK}To have at least {COMMA32} guests in your park at the end of {MONTHYEAR}, with a park rating of at least 600 STR_2386 :{BLACK}To have at least {COMMA32} guests in your park at the end of {MONTHYEAR_SENTENCE}, with a park rating of at least 600
STR_2387 :{BLACK}To achieve a park value of at least {POP16}{POP16}{CURRENCY} at the end of {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} STR_2387 :{BLACK}To achieve a park value of at least {POP16}{POP16}{CURRENCY} at the end of {PUSH16}{PUSH16}{PUSH16}{PUSH16}{PUSH16}{MONTHYEAR_SENTENCE}
STR_2388 :{BLACK}Have Fun! STR_2388 :{BLACK}Have Fun!
STR_2389 :{BLACK}Build the best {STRINGID} you can! STR_2389 :{BLACK}Build the best {STRINGID} you can!
STR_2390 :{BLACK}To have 10 different types of roller coasters operating in your park, each with an excitement value of at least 6.00 STR_2390 :{BLACK}To have 10 different types of roller coasters operating in your park, each with an excitement value of at least 6.00
@@ -1950,6 +1950,7 @@ STR_2732 :{COMMA32} ft
STR_2733 :{COMMA32} m STR_2733 :{COMMA32} m
STR_2734 :{COMMA16} mph STR_2734 :{COMMA16} mph
STR_2735 :{COMMA16} km/h STR_2735 :{COMMA16} km/h
# Used only as part of label-value pair.
STR_2736 :{MONTH}, Year {COMMA16} STR_2736 :{MONTH}, Year {COMMA16}
STR_2737 :{STRINGID} {MONTH}, Year {COMMA16} STR_2737 :{STRINGID} {MONTH}, Year {COMMA16}
STR_2738 :Title screen music: STR_2738 :Title screen music:
@@ -3743,6 +3744,8 @@ STR_6670 :Guest behaviour
STR_6671 :Show real names of staff STR_6671 :Show real names of staff
STR_6672 :Toggle between showing real names of staff and staff numbers STR_6672 :Toggle between showing real names of staff and staff numbers
STR_6673 :Transparent STR_6673 :Transparent
# Used as part of a sentence (see https://github.com/OpenRCT2/OpenRCT2/issues/22072).
STR_6674 :{MONTH}, Year {COMMA16}
############# #############
# Scenarios # # Scenarios #

View File

@@ -14,6 +14,7 @@
- Fix: [#7672] Wide path status is set to all wide paths, instead of only a quarter, impeding pathfinding. - Fix: [#7672] Wide path status is set to all wide paths, instead of only a quarter, impeding pathfinding.
- Fix: [#15406] Tunnels on steep Side-Friction track are drawn too low. - Fix: [#15406] Tunnels on steep Side-Friction track are drawn too low.
- Fix: [#21959] “Save this before...?” message does not appear when selecting “New Game”. - Fix: [#21959] “Save this before...?” message does not appear when selecting “New Game”.
- Fix: [#22072] Objective date string and staff tenure date string cannot be reused on agglutinative languages.
- Fix: [#22231] Invalid object version can cause a crash. - Fix: [#22231] Invalid object version can cause a crash.
- Fix: [#22562] Bottom row of pixels is not always drawn by the OpenGL renderer when zoomed in. - Fix: [#22562] Bottom row of pixels is not always drawn by the OpenGL renderer when zoomed in.
- Fix: [#22653] Missing water tiles in RCT1 and RCT2 scenarios. - Fix: [#22653] Missing water tiles in RCT1 and RCT2 scenarios.

View File

@@ -38,6 +38,7 @@ static const EnumMap<FormatToken> FormatTokenMap = {
{ "STRINGID", FormatToken::StringById, }, { "STRINGID", FormatToken::StringById, },
{ "STRING", FormatToken::String, }, { "STRING", FormatToken::String, },
{ "MONTHYEAR", FormatToken::MonthYear, }, { "MONTHYEAR", FormatToken::MonthYear, },
{ "MONTHYEAR_SENTENCE", FormatToken::MonthYearSentence, },
{ "MONTH", FormatToken::Month, }, { "MONTH", FormatToken::Month, },
{ "VELOCITY", FormatToken::Velocity, }, { "VELOCITY", FormatToken::Velocity, },
{ "POP16", FormatToken::Pop16, }, { "POP16", FormatToken::Pop16, },
@@ -98,6 +99,7 @@ bool FormatTokenTakesArgument(FormatToken token)
case FormatToken::StringById: case FormatToken::StringById:
case FormatToken::String: case FormatToken::String:
case FormatToken::MonthYear: case FormatToken::MonthYear:
case FormatToken::MonthYearSentence:
case FormatToken::Month: case FormatToken::Month:
case FormatToken::Velocity: case FormatToken::Velocity:
case FormatToken::DurationShort: case FormatToken::DurationShort:

View File

@@ -37,6 +37,7 @@ enum class FormatToken
StringById, StringById,
String, String,
MonthYear, MonthYear,
MonthYearSentence,
Month, Month,
Velocity, Velocity,
DurationShort, DurationShort,

View File

@@ -25,7 +25,7 @@
namespace OpenRCT2 namespace OpenRCT2
{ {
static void FormatMonthYear(FormatBuffer& ss, int32_t month, int32_t year); static void FormatMonthYear(FormatBuffer& ss, int32_t month, int32_t year, bool inSentence);
static std::optional<int32_t> ParseNumericToken(std::string_view s) static std::optional<int32_t> ParseNumericToken(std::string_view s)
{ {
@@ -585,11 +585,12 @@ namespace OpenRCT2
} }
break; break;
case FormatToken::MonthYear: case FormatToken::MonthYear:
case FormatToken::MonthYearSentence:
if constexpr (std::is_integral<T>()) if constexpr (std::is_integral<T>())
{ {
auto month = DateGetMonth(arg); auto month = DateGetMonth(arg);
auto year = DateGetYear(arg) + 1; auto year = DateGetYear(arg) + 1;
FormatMonthYear(ss, month, year); FormatMonthYear(ss, month, year, token == FormatToken::MonthYearSentence);
} }
break; break;
case FormatToken::Month: case FormatToken::Month:
@@ -779,6 +780,7 @@ namespace OpenRCT2
break; break;
case FormatToken::UInt16: case FormatToken::UInt16:
case FormatToken::MonthYear: case FormatToken::MonthYear:
case FormatToken::MonthYearSentence:
case FormatToken::Month: case FormatToken::Month:
case FormatToken::Velocity: case FormatToken::Velocity:
case FormatToken::DurationShort: case FormatToken::DurationShort:
@@ -815,12 +817,13 @@ namespace OpenRCT2
} }
} }
static void FormatMonthYear(FormatBuffer& ss, int32_t month, int32_t year) static void FormatMonthYear(FormatBuffer& ss, int32_t month, int32_t year, bool inSentence)
{ {
thread_local std::vector<FormatArg_t> tempArgs; thread_local std::vector<FormatArg_t> tempArgs;
tempArgs.clear(); tempArgs.clear();
auto fmt = GetFmtStringById(STR_DATE_FORMAT_MY); auto stringId = inSentence ? STR_DATE_FORMAT_MY_SENTENCE : STR_DATE_FORMAT_MY;
auto fmt = GetFmtStringById(stringId);
Formatter ft; Formatter ft;
ft.Add<uint16_t>(month); ft.Add<uint16_t>(month);
ft.Add<uint16_t>(year); ft.Add<uint16_t>(year);

View File

@@ -1692,6 +1692,8 @@ enum : StringId
STR_CHEAT_IGNORE_PRICE = 6659, STR_CHEAT_IGNORE_PRICE = 6659,
STR_DATE_FORMAT_MY_SENTENCE = 6674,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
}; };

View File

@@ -42,7 +42,7 @@ TEST_F(FmtStringTests, iteration)
actual += String::StdFormat("[%d:%s]", t.kind, std::string(t.text).c_str()); actual += String::StdFormat("[%d:%s]", t.kind, std::string(t.text).c_str());
} }
ASSERT_EQ("[29:{BLACK}][1:Guests: ][8:{INT32}]", actual); ASSERT_EQ("[30:{BLACK}][1:Guests: ][8:{INT32}]", actual);
} }
TEST_F(FmtStringTests, iteration_escaped) TEST_F(FmtStringTests, iteration_escaped)