mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-28 22:51:05 -04:00
Merge branch 'master' of https://gitlab.com/OpenMW/openmw
This commit is contained in:
parent
3a05ddb982
commit
21367a6127
@ -24,6 +24,8 @@ namespace
|
|||||||
constexpr VFS::Path::NormalizedView test2EnPath("l10n/test2/en.yaml");
|
constexpr VFS::Path::NormalizedView test2EnPath("l10n/test2/en.yaml");
|
||||||
constexpr VFS::Path::NormalizedView test3EnPath("l10n/test3/en.yaml");
|
constexpr VFS::Path::NormalizedView test3EnPath("l10n/test3/en.yaml");
|
||||||
constexpr VFS::Path::NormalizedView test3DePath("l10n/test3/de.yaml");
|
constexpr VFS::Path::NormalizedView test3DePath("l10n/test3/de.yaml");
|
||||||
|
constexpr VFS::Path::NormalizedView test4RuPath("l10n/test4/ru.yaml");
|
||||||
|
constexpr VFS::Path::NormalizedView test4EnPath("l10n/test4/en.yaml");
|
||||||
|
|
||||||
VFSTestFile invalidScript("not a script");
|
VFSTestFile invalidScript("not a script");
|
||||||
VFSTestFile incorrectScript(
|
VFSTestFile incorrectScript(
|
||||||
@ -69,6 +71,16 @@ currency: "You have {money, number, currency}"
|
|||||||
VFSTestFile test2En(R"X(
|
VFSTestFile test2En(R"X(
|
||||||
good_morning: "Morning!"
|
good_morning: "Morning!"
|
||||||
you_have_arrows: "Arrows count: {count}"
|
you_have_arrows: "Arrows count: {count}"
|
||||||
|
)X");
|
||||||
|
|
||||||
|
VFSTestFile test4Ru(R"X(
|
||||||
|
skill_increase: "Ваш навык {навык} увеличился до {value}"
|
||||||
|
acrobatics: "Акробатика"
|
||||||
|
)X");
|
||||||
|
|
||||||
|
VFSTestFile test4En(R"X(
|
||||||
|
stat_increase: "Your {stat} has increased to {value}"
|
||||||
|
speed: "Speed"
|
||||||
)X");
|
)X");
|
||||||
|
|
||||||
struct LuaL10nTest : Test
|
struct LuaL10nTest : Test
|
||||||
@ -80,6 +92,8 @@ you_have_arrows: "Arrows count: {count}"
|
|||||||
{ test2EnPath, &test2En },
|
{ test2EnPath, &test2En },
|
||||||
{ test3EnPath, &test1En },
|
{ test3EnPath, &test1En },
|
||||||
{ test3DePath, &test1De },
|
{ test3DePath, &test1De },
|
||||||
|
{ test4RuPath, &test4Ru },
|
||||||
|
{ test4EnPath, &test4En },
|
||||||
});
|
});
|
||||||
|
|
||||||
LuaUtil::ScriptsConfiguration mCfg;
|
LuaUtil::ScriptsConfiguration mCfg;
|
||||||
@ -169,6 +183,18 @@ you_have_arrows: "Arrows count: {count}"
|
|||||||
l.safe_script("t3 = l10n('Test3', 'de')");
|
l.safe_script("t3 = l10n('Test3', 'de')");
|
||||||
l10nManager.setPreferredLocales({ "en" });
|
l10nManager.setPreferredLocales({ "en" });
|
||||||
EXPECT_EQ(get<std::string>(l, "t3('Hello {name}!', {name='World'})"), "Hallo World!");
|
EXPECT_EQ(get<std::string>(l, "t3('Hello {name}!', {name='World'})"), "Hallo World!");
|
||||||
|
|
||||||
|
// Test that formatting arguments use a correct encoding
|
||||||
|
l.safe_script("t4 = l10n('Test4', 'ru')");
|
||||||
|
l10nManager.setPreferredLocales({ "ru", "en" });
|
||||||
|
EXPECT_EQ(get<std::string>(l, "t4('skill_increase', {навык='Акробатика', value=100})"),
|
||||||
|
"Ваш навык Акробатика увеличился до 100");
|
||||||
|
EXPECT_EQ(get<std::string>(l, "t4('skill_increase', {навык=t4('acrobatics'), value=100})"),
|
||||||
|
"Ваш навык Акробатика увеличился до 100");
|
||||||
|
EXPECT_EQ(get<std::string>(l, "t4('stat_increase', {stat='Speed', value=100})"),
|
||||||
|
"Your Speed has increased to 100");
|
||||||
|
EXPECT_EQ(get<std::string>(l, "t4('stat_increase', {stat=t4('speed'), value=100})"),
|
||||||
|
"Your Speed has increased to 100");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ namespace
|
|||||||
// Scroll the list to keep the active item in view
|
// Scroll the list to keep the active item in view
|
||||||
Gui::MWList* list = getWidget<Gui::MWList>(mQuestMode ? QuestsList : TopicsList);
|
Gui::MWList* list = getWidget<Gui::MWList>(mQuestMode ? QuestsList : TopicsList);
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (int i = 3; i < static_cast<int>(mSelectedQuest); i++)
|
for (int i = 4; i < static_cast<int>(mSelectedQuest); i++)
|
||||||
offset += mButtons[i]->getHeight();
|
offset += mButtons[i]->getHeight();
|
||||||
list->setViewOffset(-offset);
|
list->setViewOffset(-offset);
|
||||||
}
|
}
|
||||||
|
@ -332,14 +332,15 @@ void MWState::StateManager::saveGame(std::string_view description, const Slot* s
|
|||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
if (stream.fail())
|
if (stream.fail())
|
||||||
throw std::runtime_error("Write operation failed (memory stream)");
|
throw std::runtime_error(
|
||||||
|
"Write operation failed (memory stream): " + std::generic_category().message(errno));
|
||||||
|
|
||||||
// All good, write to file
|
// All good, write to file
|
||||||
std::ofstream filestream(slot->mPath, std::ios::binary);
|
std::ofstream filestream(slot->mPath, std::ios::binary);
|
||||||
filestream << stream.rdbuf();
|
filestream << stream.rdbuf();
|
||||||
|
|
||||||
if (filestream.fail())
|
if (filestream.fail())
|
||||||
throw std::runtime_error("Write operation failed (file stream)");
|
throw std::runtime_error("Write operation failed (file stream): " + std::generic_category().message(errno));
|
||||||
|
|
||||||
Settings::saves().mCharacter.set(Files::pathToUnicodeString(slot->mPath.parent_path().filename()));
|
Settings::saves().mCharacter.set(Files::pathToUnicodeString(slot->mPath.parent_path().filename()));
|
||||||
mLastSavegame = slot->mPath;
|
mLastSavegame = slot->mPath;
|
||||||
|
@ -18,7 +18,11 @@ namespace
|
|||||||
{
|
{
|
||||||
// Argument values
|
// Argument values
|
||||||
if (value.is<std::string>())
|
if (value.is<std::string>())
|
||||||
args.push_back(icu::Formattable(LuaUtil::cast<std::string>(value).c_str()));
|
{
|
||||||
|
const auto& str = LuaUtil::cast<std::string>(value);
|
||||||
|
args.push_back(icu::Formattable(icu::UnicodeString::fromUTF8(str.c_str())));
|
||||||
|
}
|
||||||
|
|
||||||
// Note: While we pass all numbers as doubles, they still seem to be handled appropriately.
|
// Note: While we pass all numbers as doubles, they still seem to be handled appropriately.
|
||||||
// Numbers can be forced to be integers using the argType number and argStyle integer
|
// Numbers can be forced to be integers using the argType number and argStyle integer
|
||||||
// E.g. {var, number, integer}
|
// E.g. {var, number, integer}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user