From 380bb98e33b00d9540e49bfb456a152df7acf197 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 30 Apr 2018 09:56:14 -0700 Subject: [PATCH 1/8] Initial Commit --- Editor/locale/CMakeLists.txt | 8 +++++ Editor/locale/en_GB.yaml | 18 ++++++++++ Editor/locale/en_US.yaml | 18 ++++++++++ Editor/locale/ja_JP.yaml | 18 ++++++++++ Editor/locale/locale.cpp | 69 ++++++++++++++++++++++++++++++++++++ Editor/locale/locale.hpp | 15 ++++++++ 6 files changed, 146 insertions(+) create mode 100644 Editor/locale/CMakeLists.txt create mode 100644 Editor/locale/en_GB.yaml create mode 100644 Editor/locale/en_US.yaml create mode 100644 Editor/locale/ja_JP.yaml create mode 100644 Editor/locale/locale.cpp create mode 100644 Editor/locale/locale.hpp diff --git a/Editor/locale/CMakeLists.txt b/Editor/locale/CMakeLists.txt new file mode 100644 index 000000000..fc4666043 --- /dev/null +++ b/Editor/locale/CMakeLists.txt @@ -0,0 +1,8 @@ +bintoc(en_US.cpp en_US.yaml L_en_US) +bintoc(en_GB.cpp en_GB.yaml L_en_GB) +bintoc(ja_JP.cpp ja_JP.yaml L_ja_JP) +add_library(UrdeLocales + en_US.yaml en_US.cpp + en_GB.yaml en_GB.cpp + ja_JP.yaml ja_JP.cpp + locale.hpp locale.cpp) diff --git a/Editor/locale/en_GB.yaml b/Editor/locale/en_GB.yaml new file mode 100644 index 000000000..595f29f28 --- /dev/null +++ b/Editor/locale/en_GB.yaml @@ -0,0 +1,18 @@ +en_GB: + color: "Colour" + branch: "Branch" + commit: "Commit" + date: "Date" + new_project: "New Project" + open_project: "Open Project" + extract_game: "Extract Game" + name: "Name" + type: "Type" + size: "Size" + directory: "Directory" + file: "File" + file_name: "File Name" + cancel: "Cancel" + system_locations: "System Locations" + recent_projects: "Recent Projects" + recent_files: "Recent Files" diff --git a/Editor/locale/en_US.yaml b/Editor/locale/en_US.yaml new file mode 100644 index 000000000..a66066a8d --- /dev/null +++ b/Editor/locale/en_US.yaml @@ -0,0 +1,18 @@ +en_US: + color: "Color" + branch: "Branch" + commit: "Commit" + date: "Date" + new_project: "New Project" + open_project: "Open Project" + extract_game: "Extract Game" + name: "Name" + type: "Type" + size: "Size" + directory: "Directory" + file: "File" + file_name: "File Name" + cancel: "Cancel" + system_locations: "System Locations" + recent_projects: "Recent Projects" + recent_files: "Recent Files" diff --git a/Editor/locale/ja_JP.yaml b/Editor/locale/ja_JP.yaml new file mode 100644 index 000000000..144468948 --- /dev/null +++ b/Editor/locale/ja_JP.yaml @@ -0,0 +1,18 @@ +ja_JP: + color: "色" + branch: "分派" + commit: "預ける" + date: "年月日" + new_project: "新しいプロジェクト" + open_project: "プロジェクトを開きます" + extract_game: "ビデオゲームを抽出" + name: "名" + type: "タイプ" + size: "サイズ" + directory: "ディレクトリ" + file: "ファイル" + file_name: "ファイル名" + cancel: "キャンセル" + system_locations: "システムの場所" + recent_projects: "最近使ったプロジェクト" + recent_files: "最近使用したファイル" diff --git a/Editor/locale/locale.cpp b/Editor/locale/locale.cpp new file mode 100644 index 000000000..c979e4dce --- /dev/null +++ b/Editor/locale/locale.cpp @@ -0,0 +1,69 @@ +#include "locale.hpp" +#include +#include +#include + +#undef min +#undef max + +extern "C" const uint8_t L_en_US[]; +extern "C" size_t L_en_US_SZ; + +extern "C" const uint8_t L_en_GB[]; +extern "C" size_t L_en_GB_SZ; + +extern "C" const uint8_t L_ja_JP[]; +extern "C" size_t L_ja_JP_SZ; + +namespace urde +{ + +using namespace std::literals; + +static const specter::Locale Locales[] = +{ + {"en_US"sv, "US English"sv, L_en_US, L_en_US_SZ}, + {"en_GB"sv, "British English"sv, L_en_GB, L_en_GB_SZ}, + {"ja_JP"sv, "Japanese"sv, L_ja_JP, L_ja_JP_SZ} +}; + +std::vector> ListLocales() +{ + constexpr size_t localeCount = std::extent::value; + std::vector> ret; + ret.reserve(localeCount); + for (size_t i=0 ; i::value; + for (size_t i=0 ; i::value; + for (size_t i=0 ; i + +namespace urde +{ + +std::vector> ListLocales(); +const specter::Locale* LookupLocale(std::string_view name); +const specter::Locale* SystemLocaleOrEnglish(); + +} + +#endif // URDE_LOCALE_HPP From c7c046763abc95e1816d2e3b514f71ebefd3aadf Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 6 Oct 2018 17:40:45 -1000 Subject: [PATCH 2/8] Convert to pragma once --- Editor/locale/locale.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Editor/locale/locale.hpp b/Editor/locale/locale.hpp index c67d3f53e..1c75b24ce 100644 --- a/Editor/locale/locale.hpp +++ b/Editor/locale/locale.hpp @@ -1,5 +1,4 @@ -#ifndef URDE_LOCALE_HPP -#define URDE_LOCALE_HPP +#pragma once #include @@ -12,4 +11,3 @@ const specter::Locale* SystemLocaleOrEnglish(); } -#endif // URDE_LOCALE_HPP From cb32cac2c0a9980f1243cc85ab7a61260dfdab4c Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 7 Dec 2018 19:19:15 -1000 Subject: [PATCH 3/8] New code style refactor --- Editor/locale/locale.cpp | 74 +++++++++++++++++----------------------- Editor/locale/locale.hpp | 6 ++-- 2 files changed, 34 insertions(+), 46 deletions(-) diff --git a/Editor/locale/locale.cpp b/Editor/locale/locale.cpp index c979e4dce..7c8e5273e 100644 --- a/Editor/locale/locale.cpp +++ b/Editor/locale/locale.cpp @@ -15,55 +15,45 @@ extern "C" size_t L_en_GB_SZ; extern "C" const uint8_t L_ja_JP[]; extern "C" size_t L_ja_JP_SZ; -namespace urde -{ +namespace urde { using namespace std::literals; -static const specter::Locale Locales[] = -{ - {"en_US"sv, "US English"sv, L_en_US, L_en_US_SZ}, - {"en_GB"sv, "British English"sv, L_en_GB, L_en_GB_SZ}, - {"ja_JP"sv, "Japanese"sv, L_ja_JP, L_ja_JP_SZ} -}; +static const specter::Locale Locales[] = {{"en_US"sv, "US English"sv, L_en_US, L_en_US_SZ}, + {"en_GB"sv, "British English"sv, L_en_GB, L_en_GB_SZ}, + {"ja_JP"sv, "Japanese"sv, L_ja_JP, L_ja_JP_SZ}}; -std::vector> ListLocales() -{ - constexpr size_t localeCount = std::extent::value; - std::vector> ret; - ret.reserve(localeCount); - for (size_t i=0 ; i> ListLocales() { + constexpr size_t localeCount = std::extent::value; + std::vector> ret; + ret.reserve(localeCount); + for (size_t i = 0; i < localeCount; ++i) { + const specter::Locale& l = Locales[i]; + ret.emplace_back(l.name(), l.fullName()); + } + return ret; } -const specter::Locale* LookupLocale(std::string_view name) -{ - constexpr size_t localeCount = std::extent::value; - for (size_t i=0 ; i::value; + for (size_t i = 0; i < localeCount; ++i) { + const specter::Locale& l = Locales[i]; + if (!name.compare(l.name())) + return &l; + } + return nullptr; } -const specter::Locale* SystemLocaleOrEnglish() -{ - const char* sysLocale = std::setlocale(LC_ALL, nullptr); - size_t sysLocaleLen = std::strlen(sysLocale); - constexpr size_t localeCount = std::extent::value; - for (size_t i=0 ; i::value; + for (size_t i = 0; i < localeCount; ++i) { + const specter::Locale& l = Locales[i]; + if (!l.name().compare(0, std::min(l.name().size(), sysLocaleLen), sysLocale)) + return &l; + } + return Locales; } -} +} // namespace urde diff --git a/Editor/locale/locale.hpp b/Editor/locale/locale.hpp index 1c75b24ce..f924e9b14 100644 --- a/Editor/locale/locale.hpp +++ b/Editor/locale/locale.hpp @@ -2,12 +2,10 @@ #include -namespace urde -{ +namespace urde { std::vector> ListLocales(); const specter::Locale* LookupLocale(std::string_view name); const specter::Locale* SystemLocaleOrEnglish(); -} - +} // namespace urde From 91824e14eadf9dd97a607a4b9a53464769698287 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 11 Jun 2019 16:02:19 -1000 Subject: [PATCH 4/8] Better CMake dependency handling --- Editor/locale/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Editor/locale/CMakeLists.txt b/Editor/locale/CMakeLists.txt index fc4666043..e82d8d9f3 100644 --- a/Editor/locale/CMakeLists.txt +++ b/Editor/locale/CMakeLists.txt @@ -6,3 +6,4 @@ add_library(UrdeLocales en_GB.yaml en_GB.cpp ja_JP.yaml ja_JP.cpp locale.hpp locale.cpp) +target_link_libraries(UrdeLocales specter) From 16851c586985a6cb21177f58c244a8468d05a8d0 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 19 Jul 2019 18:25:01 -1000 Subject: [PATCH 5/8] Compile-time locale refactor --- Editor/locale/CMakeLists.txt | 24 +++++--- Editor/locale/en_GB.yaml | 17 +---- Editor/locale/en_US.yaml | 23 +++++++ Editor/locale/genlocales.cpp | 116 +++++++++++++++++++++++++++++++++++ Editor/locale/ja_JP.yaml | 1 + Editor/locale/locale.cpp | 54 +++++----------- Editor/locale/locale.hpp | 44 +++++++++++-- 7 files changed, 211 insertions(+), 68 deletions(-) create mode 100644 Editor/locale/genlocales.cpp diff --git a/Editor/locale/CMakeLists.txt b/Editor/locale/CMakeLists.txt index e82d8d9f3..313d05c15 100644 --- a/Editor/locale/CMakeLists.txt +++ b/Editor/locale/CMakeLists.txt @@ -1,9 +1,15 @@ -bintoc(en_US.cpp en_US.yaml L_en_US) -bintoc(en_GB.cpp en_GB.yaml L_en_GB) -bintoc(ja_JP.cpp ja_JP.yaml L_ja_JP) -add_library(UrdeLocales - en_US.yaml en_US.cpp - en_GB.yaml en_GB.cpp - ja_JP.yaml ja_JP.cpp - locale.hpp locale.cpp) -target_link_libraries(UrdeLocales specter) +add_executable(genlocales genlocales.cpp) +target_link_libraries(genlocales fmt athena-core) + +set(LOCALES_IN en_US.yaml en_GB.yaml ja_JP.yaml) +set(LOCALES_OUT ${CMAKE_CURRENT_BINARY_DIR}/locales-inl.hpp) +add_custom_command(OUTPUT ${LOCALES_OUT} COMMAND $ + ARGS ${LOCALES_OUT} ${LOCALES_IN} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS genlocales ${LOCALES_IN}) + +add_library(UrdeLocales ${LOCALES_OUT} locale.hpp locale.cpp) +target_link_libraries(UrdeLocales fmt) +target_include_directories(UrdeLocales PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + +target_link_libraries(specter PUBLIC UrdeLocales) diff --git a/Editor/locale/en_GB.yaml b/Editor/locale/en_GB.yaml index 595f29f28..2b5a4cf0c 100644 --- a/Editor/locale/en_GB.yaml +++ b/Editor/locale/en_GB.yaml @@ -1,18 +1,3 @@ +name: "British English" en_GB: color: "Colour" - branch: "Branch" - commit: "Commit" - date: "Date" - new_project: "New Project" - open_project: "Open Project" - extract_game: "Extract Game" - name: "Name" - type: "Type" - size: "Size" - directory: "Directory" - file: "File" - file_name: "File Name" - cancel: "Cancel" - system_locations: "System Locations" - recent_projects: "Recent Projects" - recent_files: "Recent Files" diff --git a/Editor/locale/en_US.yaml b/Editor/locale/en_US.yaml index a66066a8d..509e1789e 100644 --- a/Editor/locale/en_US.yaml +++ b/Editor/locale/en_US.yaml @@ -1,7 +1,9 @@ +name: "US English" en_US: color: "Color" branch: "Branch" commit: "Commit" + release: "Release" date: "Date" new_project: "New Project" open_project: "Open Project" @@ -16,3 +18,24 @@ en_US: system_locations: "System Locations" recent_projects: "Recent Projects" recent_files: "Recent Files" + scroll_left: "Scroll Left" + scroll_right: "Scroll Right" + ok: "OK" + cancel: "Cancel" + boundary_action: "Boundary Action" + split: "Split" + join: "Join" + hecl_project: "HECL Project" + no_access_as_dir: "Unable to access '{}' as directory" + file_field_empty: "Unable to save empty file" + overwrite_confirm: "Overwrite '{}'?" + directory_field_empty: "Unable to make empty-named directory" + no_overwrite_file: "Unable to make directory over file" + no_overwrite_project: "Unable to make project within existing project" + no_access_as_file: "Unable to access '{}' as file" + space_types: "Space Types" + resource_browser: "Resource Browser" + effect_editor: "Effect Editor" + model_viewer: "Model Viewer" + information_center: "Information Center" + game_mode: "Game Mode" \ No newline at end of file diff --git a/Editor/locale/genlocales.cpp b/Editor/locale/genlocales.cpp new file mode 100644 index 000000000..235fc9ebc --- /dev/null +++ b/Editor/locale/genlocales.cpp @@ -0,0 +1,116 @@ +#include +#include +#include +#include +#include "athena/FileReader.hpp" +#include "athena/YAMLDocReader.hpp" + +#define FMT_STRING_ALIAS 1 +#define FMT_ENFORCE_COMPILE_STRING 1 +#define FMT_USE_GRISU 0 +#include +#include + +int main(int argc, char** argv) { + if (argc < 3) { + fmt::print(fmt("{} ...\n"), argv[0]); + return 1; + } + + std::ofstream out(argv[1]); + if (!out.is_open()) { + fmt::print(fmt("Unable to open {} for writing\n"), argv[1]); + return 1; + } + + std::unordered_set seenLocales; + std::stringstream enumLocales; + std::stringstream declLocales; + std::unordered_set seenKeys; + std::stringstream keys; + std::stringstream lookups; + std::stringstream dos; + + for (int i = 2; i < argc; ++i) { + athena::io::FileReader fr(argv[i]); + if (!fr.isOpen()) { + fmt::print(fmt("Unable to open {} for reading\n"), argv[i]); + return 1; + } + athena::io::YAMLDocReader r; + if (!r.parse(&fr)) { + fmt::print(fmt("Unable to parse {}\n"), argv[i]); + return 1; + } + + std::string name; + std::string fullName; + athena::io::YAMLNode* listNode = nullptr; + for (const auto& c : r.getRootNode()->m_mapChildren) { + if (c.first == "name") { + fullName = c.second->m_scalarString; + } else { + name = c.first; + listNode = c.second.get(); + } + } + if (fullName.empty()) { + fmt::print(fmt("Unable to find 'name' node in {}\n"), argv[i]); + return 1; + } + if (!listNode) { + fmt::print(fmt("Unable to find list node in {}\n"), argv[i]); + return 1; + } + + if (seenLocales.find(name) == seenLocales.end()) { + seenLocales.insert(name); + fmt::print(enumLocales, fmt(" {},\n"), name); + fmt::print(declLocales, + fmt("struct {0} {{ static constexpr auto Name = \"{0}\"sv; static constexpr auto FullName = \"{1}\"sv; }};\n"), + name, fullName); + fmt::print(dos, + fmt(" case ELocale::{0}:\n" + " return act.template Do<{0}>(std::forward(args)...);\n"), name); + fmt::print(lookups, fmt("/* {} */\n"), name); + for (const auto& k : listNode->m_mapChildren) { + if (seenKeys.find(k.first) == seenKeys.end()) { + seenKeys.insert(k.first); + fmt::print(keys, fmt("struct {} {{}};\n"), k.first); + } + fmt::print(lookups, + fmt("template<> struct Lookup<{}, {}> {{ static constexpr auto Value() {{ return fmt(\"{}\"); }} }};\n"), + name, k.first, k.second->m_scalarString); + } + } + lookups << '\n'; + } + + out << "/* Locales */\n" + "enum class ELocale {\n" + " Invalid = -1,\n"; + out << enumLocales.str(); + out << " MAXLocale\n" + "};\n"; + out << declLocales.str(); + out << "\n" + "using DefaultLocale = en_US;\n" + "template struct Lookup {\n" + " static_assert(!std::is_same_v, \"The default locale must translate all keys\");\n" + " static constexpr auto Value() { return Lookup::Value(); }\n" + "};\n" + "\n" + "/* Keys */\n"; + out << keys.str(); + out << "\n"; + out << lookups.str(); + out << "template \n" + "constexpr auto Do(ELocale l, Action act, Args&&... args) {\n" + " switch (l) {\n" + " default:\n"; + out << dos.str(); + out << " }\n" + "}\n"; + + return 0; +} diff --git a/Editor/locale/ja_JP.yaml b/Editor/locale/ja_JP.yaml index 144468948..847736741 100644 --- a/Editor/locale/ja_JP.yaml +++ b/Editor/locale/ja_JP.yaml @@ -1,3 +1,4 @@ +name: "日本語" ja_JP: color: "色" branch: "分派" diff --git a/Editor/locale/locale.cpp b/Editor/locale/locale.cpp index 7c8e5273e..8aa21ebf3 100644 --- a/Editor/locale/locale.cpp +++ b/Editor/locale/locale.cpp @@ -6,54 +6,32 @@ #undef min #undef max -extern "C" const uint8_t L_en_US[]; -extern "C" size_t L_en_US_SZ; - -extern "C" const uint8_t L_en_GB[]; -extern "C" size_t L_en_GB_SZ; - -extern "C" const uint8_t L_ja_JP[]; -extern "C" size_t L_ja_JP_SZ; - -namespace urde { - -using namespace std::literals; - -static const specter::Locale Locales[] = {{"en_US"sv, "US English"sv, L_en_US, L_en_US_SZ}, - {"en_GB"sv, "British English"sv, L_en_GB, L_en_GB_SZ}, - {"ja_JP"sv, "Japanese"sv, L_ja_JP, L_ja_JP_SZ}}; +namespace locale { std::vector> ListLocales() { - constexpr size_t localeCount = std::extent::value; std::vector> ret; - ret.reserve(localeCount); - for (size_t i = 0; i < localeCount; ++i) { - const specter::Locale& l = Locales[i]; - ret.emplace_back(l.name(), l.fullName()); - } + ret.reserve(std::size_t(ELocale::MAXLocale)); + for (ELocale l = ELocale(0); l < ELocale::MAXLocale; l = ELocale(int(l) + 1)) + ret.emplace_back(GetName(l), GetFullName(l)); return ret; } -const specter::Locale* LookupLocale(std::string_view name) { - constexpr size_t localeCount = std::extent::value; - for (size_t i = 0; i < localeCount; ++i) { - const specter::Locale& l = Locales[i]; - if (!name.compare(l.name())) - return &l; - } - return nullptr; +ELocale LookupLocale(std::string_view name) { + for (ELocale l = ELocale(0); l < ELocale::MAXLocale; l = ELocale(int(l) + 1)) + if (!name.compare(GetName(l))) + return l; + return ELocale::Invalid; } -const specter::Locale* SystemLocaleOrEnglish() { +ELocale SystemLocaleOrEnglish() { const char* sysLocale = std::setlocale(LC_ALL, nullptr); size_t sysLocaleLen = std::strlen(sysLocale); - constexpr size_t localeCount = std::extent::value; - for (size_t i = 0; i < localeCount; ++i) { - const specter::Locale& l = Locales[i]; - if (!l.name().compare(0, std::min(l.name().size(), sysLocaleLen), sysLocale)) - return &l; + for (ELocale l = ELocale(0); l < ELocale::MAXLocale; l = ELocale(int(l) + 1)) { + auto name = GetName(l); + if (!name.compare(0, std::min(name.size(), sysLocaleLen), sysLocale)) + return l; } - return Locales; + return ELocale::en_US; } -} // namespace urde +} // namespace locale diff --git a/Editor/locale/locale.hpp b/Editor/locale/locale.hpp index f924e9b14..4e152a485 100644 --- a/Editor/locale/locale.hpp +++ b/Editor/locale/locale.hpp @@ -1,11 +1,45 @@ #pragma once +#include +#include +#include -#include +#define FMT_STRING_ALIAS 1 +#define FMT_ENFORCE_COMPILE_STRING 1 +#define FMT_USE_GRISU 0 +#include -namespace urde { +namespace locale { +using namespace std::literals; +#include + +struct DoGetName { + template + constexpr auto Do() { return L::Name; } +}; +constexpr auto GetName(ELocale l) { + return Do(l, DoGetName()); +} + +struct DoGetFullName { + template + constexpr auto Do() { return L::FullName; } +}; +constexpr auto GetFullName(ELocale l) { + return Do(l, DoGetFullName()); +} + +template +struct DoTranslate { + template + constexpr auto Do(Args&&... args) { return fmt::format(Lookup::Value(), std::forward(args)...); } +}; +template +constexpr auto Translate(ELocale l, Args&&... args) { + return Do(l, DoTranslate(), std::forward(args)...); +} std::vector> ListLocales(); -const specter::Locale* LookupLocale(std::string_view name); -const specter::Locale* SystemLocaleOrEnglish(); +ELocale LookupLocale(std::string_view name); +ELocale SystemLocaleOrEnglish(); -} // namespace urde +} // namespace locale From 532594a4c5585f457b936a23567376f8ac5112cf Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 30 Sep 2019 21:33:12 -1000 Subject: [PATCH 6/8] Switch to string compare operator --- Editor/locale/locale.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Editor/locale/locale.cpp b/Editor/locale/locale.cpp index 8aa21ebf3..ff6d0bb34 100644 --- a/Editor/locale/locale.cpp +++ b/Editor/locale/locale.cpp @@ -18,7 +18,7 @@ std::vector> ListLocales() { ELocale LookupLocale(std::string_view name) { for (ELocale l = ELocale(0); l < ELocale::MAXLocale; l = ELocale(int(l) + 1)) - if (!name.compare(GetName(l))) + if (name == GetName(l)) return l; return ELocale::Invalid; } From 318deb24ce714cf752def6691314b8f68505cf31 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 11 Apr 2020 12:48:59 -1000 Subject: [PATCH 7/8] Update fmtlib --- Editor/locale/genlocales.cpp | 25 ++++++++++++------------- Editor/locale/locale.hpp | 1 - 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Editor/locale/genlocales.cpp b/Editor/locale/genlocales.cpp index 235fc9ebc..a7238059b 100644 --- a/Editor/locale/genlocales.cpp +++ b/Editor/locale/genlocales.cpp @@ -7,19 +7,18 @@ #define FMT_STRING_ALIAS 1 #define FMT_ENFORCE_COMPILE_STRING 1 -#define FMT_USE_GRISU 0 #include #include int main(int argc, char** argv) { if (argc < 3) { - fmt::print(fmt("{} ...\n"), argv[0]); + fmt::print(FMT_STRING("{} ...\n"), argv[0]); return 1; } std::ofstream out(argv[1]); if (!out.is_open()) { - fmt::print(fmt("Unable to open {} for writing\n"), argv[1]); + fmt::print(FMT_STRING("Unable to open {} for writing\n"), argv[1]); return 1; } @@ -34,12 +33,12 @@ int main(int argc, char** argv) { for (int i = 2; i < argc; ++i) { athena::io::FileReader fr(argv[i]); if (!fr.isOpen()) { - fmt::print(fmt("Unable to open {} for reading\n"), argv[i]); + fmt::print(FMT_STRING("Unable to open {} for reading\n"), argv[i]); return 1; } athena::io::YAMLDocReader r; if (!r.parse(&fr)) { - fmt::print(fmt("Unable to parse {}\n"), argv[i]); + fmt::print(FMT_STRING("Unable to parse {}\n"), argv[i]); return 1; } @@ -55,31 +54,31 @@ int main(int argc, char** argv) { } } if (fullName.empty()) { - fmt::print(fmt("Unable to find 'name' node in {}\n"), argv[i]); + fmt::print(FMT_STRING("Unable to find 'name' node in {}\n"), argv[i]); return 1; } if (!listNode) { - fmt::print(fmt("Unable to find list node in {}\n"), argv[i]); + fmt::print(FMT_STRING("Unable to find list node in {}\n"), argv[i]); return 1; } if (seenLocales.find(name) == seenLocales.end()) { seenLocales.insert(name); - fmt::print(enumLocales, fmt(" {},\n"), name); + fmt::print(enumLocales, FMT_STRING(" {},\n"), name); fmt::print(declLocales, - fmt("struct {0} {{ static constexpr auto Name = \"{0}\"sv; static constexpr auto FullName = \"{1}\"sv; }};\n"), + FMT_STRING("struct {0} {{ static constexpr auto Name = \"{0}\"sv; static constexpr auto FullName = \"{1}\"sv; }};\n"), name, fullName); fmt::print(dos, - fmt(" case ELocale::{0}:\n" + FMT_STRING(" case ELocale::{0}:\n" " return act.template Do<{0}>(std::forward(args)...);\n"), name); - fmt::print(lookups, fmt("/* {} */\n"), name); + fmt::print(lookups, FMT_STRING("/* {} */\n"), name); for (const auto& k : listNode->m_mapChildren) { if (seenKeys.find(k.first) == seenKeys.end()) { seenKeys.insert(k.first); - fmt::print(keys, fmt("struct {} {{}};\n"), k.first); + fmt::print(keys, FMT_STRING("struct {} {{}};\n"), k.first); } fmt::print(lookups, - fmt("template<> struct Lookup<{}, {}> {{ static constexpr auto Value() {{ return fmt(\"{}\"); }} }};\n"), + FMT_STRING("template<> struct Lookup<{}, {}> {{ static constexpr auto Value() {{ return FMT_STRING(\"{}\"); }} }};\n"), name, k.first, k.second->m_scalarString); } } diff --git a/Editor/locale/locale.hpp b/Editor/locale/locale.hpp index 4e152a485..0226aef44 100644 --- a/Editor/locale/locale.hpp +++ b/Editor/locale/locale.hpp @@ -5,7 +5,6 @@ #define FMT_STRING_ALIAS 1 #define FMT_ENFORCE_COMPILE_STRING 1 -#define FMT_USE_GRISU 0 #include namespace locale { From 8775759f679adb9aa7dc70ee967181d568da8186 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 29 Mar 2021 13:21:47 -0400 Subject: [PATCH 8/8] Add "version" string --- Editor/locale/en_US.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Editor/locale/en_US.yaml b/Editor/locale/en_US.yaml index 509e1789e..3e3871aaf 100644 --- a/Editor/locale/en_US.yaml +++ b/Editor/locale/en_US.yaml @@ -38,4 +38,5 @@ en_US: effect_editor: "Effect Editor" model_viewer: "Model Viewer" information_center: "Information Center" - game_mode: "Game Mode" \ No newline at end of file + game_mode: "Game Mode" + version: "Version" \ No newline at end of file