mirror of https://github.com/AxioDL/metaforce.git
Integrate Translator
This commit is contained in:
parent
028be337c6
commit
defe2bb509
|
@ -24,8 +24,15 @@ SplashScreen::SplashScreen(ViewManager& vm, Specter::ViewResources& res)
|
|||
m_vm(vm),
|
||||
m_textColor(res.themeData().uiText()),
|
||||
m_textColorClear(m_textColor),
|
||||
m_buildInfoStr(HECL::Format("%s: %s\n%s: %s\n%s: %s",
|
||||
vm.translateOr("branch", "Branch").c_str(), GIT_BRANCH,
|
||||
vm.translateOr("commit", "Commit").c_str(), GIT_COMMIT_HASH,
|
||||
vm.translateOr("date", "Date").c_str(), GIT_COMMIT_DATE)),
|
||||
m_newString(m_vm.translateOr("new_project", "New Project")),
|
||||
m_newProjBind(*this),
|
||||
m_openString(m_vm.translateOr("open_project", "Open Project")),
|
||||
m_openProjBind(*this),
|
||||
m_extractString(m_vm.translateOr("extract_game", "Extract Game")),
|
||||
m_extractProjBind(*this)
|
||||
{
|
||||
m_textColorClear[3] = 0.0;
|
||||
|
@ -44,20 +51,21 @@ void SplashScreen::updateContentOpacity(float opacity)
|
|||
Specter::ViewResources& res = rootView().viewRes();
|
||||
|
||||
if (!m_title && res.fontCacheReady())
|
||||
{
|
||||
{
|
||||
m_title.reset(new Specter::TextView(res, *this, res.m_titleFont));
|
||||
Zeus::CColor clearColor = res.themeData().uiText();
|
||||
clearColor[3] = 0.0;
|
||||
m_title->typesetGlyphs("RUDE", clearColor);
|
||||
|
||||
m_buildInfo.reset(new Specter::MultiLineTextView(res, *this, res.m_mainFont, Specter::TextView::Alignment::Right));
|
||||
m_buildInfo->typesetGlyphs(HECL::Format("Branch: %s\nCommit: %s\nDate: %s",
|
||||
GIT_BRANCH, GIT_COMMIT_HASH, GIT_COMMIT_DATE),
|
||||
clearColor);
|
||||
m_buildInfo->typesetGlyphs(m_buildInfoStr, clearColor);
|
||||
|
||||
m_newButt.m_view.reset(new Specter::Button(res, *this, &m_newProjBind, "New Project", Specter::Button::Style::Text));
|
||||
m_openButt.m_view.reset(new Specter::Button(res, *this, &m_openProjBind, "Open Project", Specter::Button::Style::Text));
|
||||
m_extractButt.m_view.reset(new Specter::Button(res, *this, &m_extractProjBind, "Extract Game", Specter::Button::Style::Text));
|
||||
m_newButt.m_view.reset(new Specter::Button(res, *this, &m_newProjBind, m_newString,
|
||||
Specter::Button::Style::Text));
|
||||
m_openButt.m_view.reset(new Specter::Button(res, *this, &m_openProjBind, m_openString,
|
||||
Specter::Button::Style::Text));
|
||||
m_extractButt.m_view.reset(new Specter::Button(res, *this, &m_extractProjBind, m_extractString,
|
||||
Specter::Button::Style::Text));
|
||||
|
||||
updateSize();
|
||||
}
|
||||
|
|
|
@ -17,10 +17,14 @@ class SplashScreen : public Specter::ModalWindow
|
|||
Zeus::CColor m_textColorClear;
|
||||
|
||||
std::unique_ptr<Specter::TextView> m_title;
|
||||
std::string m_buildInfoStr;
|
||||
std::unique_ptr<Specter::MultiLineTextView> m_buildInfo;
|
||||
|
||||
std::string m_newString;
|
||||
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_newButt;
|
||||
std::string m_openString;
|
||||
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_openButt;
|
||||
std::string m_extractString;
|
||||
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_extractButt;
|
||||
|
||||
Specter::ViewChild<std::unique_ptr<Specter::FileBrowser>> m_fileBrowser;
|
||||
|
@ -29,13 +33,13 @@ class SplashScreen : public Specter::ModalWindow
|
|||
{
|
||||
SplashScreen& m_splash;
|
||||
NewProjBinding(SplashScreen& splash) : m_splash(splash) {}
|
||||
const char* name() const {return "New Project";}
|
||||
const char* name() const {return m_splash.m_newString.c_str();}
|
||||
const char* help() const {return "Creates an empty project at selected path";}
|
||||
void activated(const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_splash.m_fileBrowser.m_view.reset(
|
||||
new Specter::FileBrowser(m_splash.rootView().viewRes(),
|
||||
m_splash, "New Project",
|
||||
m_splash, m_splash.m_newString,
|
||||
Specter::FileBrowser::Type::SaveFile));
|
||||
m_splash.updateSize();
|
||||
m_splash.m_newButt.mouseLeave(coord);
|
||||
|
@ -46,13 +50,13 @@ class SplashScreen : public Specter::ModalWindow
|
|||
{
|
||||
SplashScreen& m_splash;
|
||||
OpenProjBinding(SplashScreen& splash) : m_splash(splash) {}
|
||||
const char* name() const {return "Open Project";}
|
||||
const char* name() const {return m_splash.m_openString.c_str();}
|
||||
const char* help() const {return "Opens an existing project at selected path";}
|
||||
void activated(const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_splash.m_fileBrowser.m_view.reset(
|
||||
new Specter::FileBrowser(m_splash.rootView().viewRes(),
|
||||
m_splash, "Open Project",
|
||||
m_splash, m_splash.m_openString,
|
||||
Specter::FileBrowser::Type::OpenHECLProject));
|
||||
m_splash.updateSize();
|
||||
m_splash.m_openButt.mouseLeave(coord);
|
||||
|
@ -63,13 +67,13 @@ class SplashScreen : public Specter::ModalWindow
|
|||
{
|
||||
SplashScreen& m_splash;
|
||||
ExtractProjBinding(SplashScreen& splash) : m_splash(splash) {}
|
||||
const char* name() const {return "Extract Game";}
|
||||
const char* name() const {return m_splash.m_extractString.c_str();}
|
||||
const char* help() const {return "Extracts game image as project at selected path";}
|
||||
void activated(const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_splash.m_fileBrowser.m_view.reset(
|
||||
new Specter::FileBrowser(m_splash.rootView().viewRes(),
|
||||
m_splash, "Extract Game",
|
||||
m_splash, m_splash.m_extractString,
|
||||
Specter::FileBrowser::Type::OpenFile));
|
||||
m_splash.updateSize();
|
||||
m_splash.m_extractButt.mouseLeave(coord);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "Specter/Control.hpp"
|
||||
#include "Specter/Space.hpp"
|
||||
#include "SplashScreen.hpp"
|
||||
#include "locale/locale.hpp"
|
||||
|
||||
using YAMLNode = Athena::io::YAMLNode;
|
||||
|
||||
|
@ -42,7 +43,7 @@ void ViewManager::SetupEditorView()
|
|||
}
|
||||
|
||||
ViewManager::ViewManager(HECL::Runtime::FileStoreManager& fileMgr, HECL::CVarManager& cvarMgr)
|
||||
: m_cvarManager(cvarMgr), m_fontCache(fileMgr),
|
||||
: m_cvarManager(cvarMgr), m_fontCache(fileMgr), m_translator(RUDE::LookupLocale("ja_JP")),
|
||||
m_setTo1(*this), m_setTo2(*this),
|
||||
m_split(*this),
|
||||
m_space1(*this, "Hello, World!\n\n", "Hello Button", &m_setTo1),
|
||||
|
|
|
@ -9,12 +9,13 @@ namespace RUDE
|
|||
{
|
||||
class SplashScreen;
|
||||
|
||||
class ViewManager : Specter::IViewManager
|
||||
class ViewManager : public Specter::IViewManager
|
||||
{
|
||||
HECL::CVarManager& m_cvarManager;
|
||||
ProjectManager m_projManager;
|
||||
Specter::FontCache m_fontCache;
|
||||
Specter::ViewResources m_viewResources;
|
||||
Specter::Translator m_translator;
|
||||
std::unique_ptr<boo::IWindow> m_mainWindow;
|
||||
std::unique_ptr<Specter::RootView> m_rootView;
|
||||
std::unique_ptr<SplashScreen> m_splash;
|
||||
|
@ -74,6 +75,7 @@ public:
|
|||
}
|
||||
|
||||
ProjectManager& projectManager() {return m_projManager;}
|
||||
const Specter::Translator* getTranslator() const {return &m_translator;}
|
||||
|
||||
void init(boo::IApplication* app);
|
||||
bool proc();
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
bintoc(en_US.c en_US.yaml L_en_US)
|
||||
bintoc(en_GB.c en_GB.yaml L_en_GB)
|
||||
bintoc(ja_JP.c ja_JP.yaml L_ja_JP)
|
||||
add_library(RudeLocales
|
||||
en_US.yaml en_US.c
|
||||
en_GB.yaml en_GB.c
|
||||
ja_JP.yaml ja_JP.c
|
||||
locale.hpp locale.cpp)
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
en_GB:
|
||||
controls:
|
||||
color: "Colour"
|
||||
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"
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
en_US:
|
||||
controls:
|
||||
color: "Color"
|
||||
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"
|
||||
|
|
|
@ -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: "最近使用したファイル"
|
|
@ -9,13 +9,17 @@ 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 RUDE
|
||||
{
|
||||
|
||||
static const Specter::Locale Locales[] =
|
||||
{
|
||||
{"en_US", "US English", L_en_US, L_en_US_SZ},
|
||||
{"en_GB", "British English", L_en_GB, L_en_GB_SZ}
|
||||
{"en_GB", "British English", L_en_GB, L_en_GB_SZ},
|
||||
{"ja_JP", "Japanese", L_ja_JP, L_ja_JP_SZ}
|
||||
};
|
||||
|
||||
std::vector<std::pair<const std::string*, const std::string*>> ListLocales()
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 68e32072c07007f4cb2cc48384719ed802b8d4e8
|
||||
Subproject commit 62bf56b5e94b4ff7f91da8741a6fad240c8d3728
|
Loading…
Reference in New Issue