WARNING! This commit can break your build. If you use another bin/output directory for the build, copy the path bin/debug/locales and its contents to your output directory!

- Implemented localization into cube
- Added english and german locales
This commit is contained in:
andre@woesten.com 2008-09-09 14:01:52 +00:00
parent 53073ffd66
commit 96d036957a
18 changed files with 263 additions and 58 deletions

View File

@ -0,0 +1,3 @@
[config]
name=English
locale_identifier=0x0409

View File

@ -0,0 +1,171 @@
[config]
name=Deutsch
locale_identifier=0x0407
[1]
original=Add path
translated=Pfad hinzufügen
[2]
original=Remove path
translated=Pfad löschen
[3]
original=Library status
translated=Aktive Bibliotheken
[4]
original=E&xit
translated=Beenden
[5]
original=Welcome to musikCube!
translated=Willkommen bei musikCube!
[6]
original=Genre
translated=Genre
[7]
original=Artist
translated=Künstler
[8]
original=Album
translated=Album
[9]
original=Sources
translated=Quellen
[10]
original=View
translated=Ansicht
[11]
original=Track
translated=Track
[12]
original=BPM
translated=BPM
[13]
original=Duration
translated=Dauer
[14]
original=Resume
translated=Fortsetzen
[15]
original=Pause
translated=Pause
[16]
original=Prev
translated=Zurück
[17]
original=Next
translated=Vor
[18]
original=Stop
translated=Stop
[19]
original=Play
translated=Play
[20]
original=Now playing
translated=Spiele
[21]
original=by
translated= von
[22]
original=Song Title
translated=Titel
[23]
original=Artist Name
translated=Künstlername
[24]
original=&File
translated=&Datei
[25]
original=&Audio
translated=&Audio
[26]
original=&View
translated=&Ansicht
[27]
original=&Tags
translated=&Tags
[28]
original=&Help
translated=&Hilfe
[29]
original=Add local library
translated=Lokale Bibliothek hinzufügen
[30]
original=Add remote library
translated=Entfernte Bibliothek hinzufügen
[31]
original=&Local library
translated=&Lokale Bibliothek
[32]
original=&Remote library
translated=&Entfernte Bibliothek
[33]
original=&Add Library
translated=Bibliothek &hinzufügen
[34]
original=&About
translated=&Über...
[35]
original=Tracks
translated=Tracks
[36]
original=Size
translated=Größe
[37]
original=Browse
translated=Durchsuchen
[38]
original=Now Playing
translated=Aktuelle Wiedergabe
[39]
original=Settings
translated=Einstellungen
[40]
original=View
translated=Ansicht
[41]
original=Playlists
translated=Playlisten
[42]
original=Path
translated=Pfad

View File

@ -158,7 +158,7 @@ HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
HTML_DYNAMIC_SECTIONS = NO
CHM_FILE =
CHM_FILE = win32cpp.chm
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
@ -256,7 +256,7 @@ CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
#DOT_PATH = "C:/Program Files/doxygen/graphviz-2.16/bin "
DOT_PATH = "C:/Program Files (x86)/doxygen/graphviz/bin"
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000

View File

@ -64,9 +64,9 @@ void BrowseView::OnCreated()
this->filterViewLayout,
this->tracklistView);
this->AddMetadataFilter(_T("genre"));
this->AddMetadataFilter(_T("artist"));
this->AddMetadataFilter(_T("album"));
this->AddMetadataFilter(_(_T("Genre")));
this->AddMetadataFilter(_(_T("Artist")));
this->AddMetadataFilter(_(_T("Album")));
this->AddChild(mainVSplitter);
mainVSplitter->SetAnchor(AnchorTop);

View File

@ -80,7 +80,7 @@ void MainMenuController::OnFileExit(MenuItemRef menuItem)
void MainMenuController::OnAddLibraryLocal(MenuItemRef menuItem)
{
win32cpp::TopLevelWindow popupDialog(_T("Add local library"));
win32cpp::TopLevelWindow popupDialog(_(_T("Add local library")));
popupDialog.SetMinimumSize(Size(300, 150));
dialog::AddLibraryController addLibrary(popupDialog,musik::core::LibraryFactory::LocalDB);
@ -90,7 +90,7 @@ void MainMenuController::OnAddLibraryLocal(MenuItemRef menuItem)
}
void MainMenuController::OnAddLibraryRemote(MenuItemRef menuItem)
{
win32cpp::TopLevelWindow popupDialog(_T("Add remote library"));
win32cpp::TopLevelWindow popupDialog(_(_T("Add remote library")));
popupDialog.SetMinimumSize(Size(300, 220));
dialog::AddLibraryController addLibrary(popupDialog,musik::core::LibraryFactory::Remote);
@ -144,11 +144,11 @@ MenuRef MainMenuController::CreateMenu()
this->mainMenu = Menu::Create();
MenuItemCollection& mainItems = this->mainMenu->Items();
//
this->file = mainItems.Append(MenuItem::Create(_T("&File")));
this->view = mainItems.Append(MenuItem::Create(_T("&View")));
this->audio = mainItems.Append(MenuItem::Create(_T("&Audio")));
this->tags = mainItems.Append(MenuItem::Create(_T("&Tags")));
this->help = mainItems.Append(MenuItem::Create(_T("&Help")));
this->file = mainItems.Append(MenuItem::Create(_(_T("&File"))));
this->view = mainItems.Append(MenuItem::Create(_(_T("&View"))));
this->audio = mainItems.Append(MenuItem::Create(_(_T("&Audio"))));
this->tags = mainItems.Append(MenuItem::Create(_(_T("&Tags"))));
this->help = mainItems.Append(MenuItem::Create(_(_T("&Help"))));
// file menu
this->fileMenu = Menu::Create();
@ -157,20 +157,20 @@ MenuRef MainMenuController::CreateMenu()
this->file->SetSubMenu(this->fileMenu);
MenuRef addLibrarySubmenu = Menu::Create();
this->fileAddLibraryLocal = addLibrarySubmenu->Items().Append(MenuItem::Create(_T("&Local library")));
this->fileAddLibraryRemote = addLibrarySubmenu->Items().Append(MenuItem::Create(_T("&Remote library")));
this->fileAddLibraryLocal = addLibrarySubmenu->Items().Append(MenuItem::Create(_(_T("&Local library"))));
this->fileAddLibraryRemote = addLibrarySubmenu->Items().Append(MenuItem::Create(_(_T("&Remote library"))));
MenuItemRef addLibraryMenu = fileItems.Append(MenuItem::Create(_T("&Add Library")));
MenuItemRef addLibraryMenu = fileItems.Append(MenuItem::Create(_(_T("&Add Library"))));
addLibraryMenu->SetSubMenu(addLibrarySubmenu);
this->fileExit = fileItems.Append(MenuItem::Create(_T("E&xit")));
this->fileExit = fileItems.Append(MenuItem::Create(_(_T("E&xit"))));
// help menu
this->helpMenu = Menu::Create();
MenuItemCollection& helpItems = this->helpMenu->Items();
//
this->help->SetSubMenu(this->helpMenu);
this->helpAbout = helpItems.Append(MenuItem::Create(_T("&About")));
this->helpAbout = helpItems.Append(MenuItem::Create(_(_T("&About"))));
this->ConnectMenuHandlers();

View File

@ -97,9 +97,7 @@ void MainWindowController::OnMainWindowCreated(Window* window)
MenuRef myMenu = Menu::CreatePopup();
// Create Tray Menu
myMenu->Items().Append(MenuItem::Create(_T("Test 1")));
myMenu->Items().Append(MenuItem::Create(_T("Test 2")));
MenuItemRef trayExit = myMenu->Items().Append(MenuItem::Create(_T("E&xit")));
MenuItemRef trayExit = myMenu->Items().Append(MenuItem::Create(_(_T("E&xit"))));
// Bind Exit to handler
trayExit->Activated.connect(this, &MainWindowController::OnFileExit);
@ -107,7 +105,7 @@ void MainWindowController::OnMainWindowCreated(Window* window)
UINT uidTrayIcon = Application::Instance().SysTrayManager()->AddIcon(Application::Instance().MainWindow(), icon16);
Application::Instance().SysTrayManager()->SetTooltip(uidTrayIcon, _T("musikCube"));
Application::Instance().SysTrayManager()->SetPopupMenu(uidTrayIcon, myMenu);
Application::Instance().SysTrayManager()->ShowBalloon(uidTrayIcon, _T("musikCube 2"), _T("Welcome to musikCube!"), 2);
Application::Instance().SysTrayManager()->ShowBalloon(uidTrayIcon, _T("musikCube 2"), _(_T("Welcome to musikCube!")), 2);
Application::Instance().SysTrayManager()->EnableMinimizeToTray(uidTrayIcon);

View File

@ -82,7 +82,7 @@ void SettingsView::OnCreated()
FontRef boldFont(Font::Create());
boldFont->SetBold(true);
win32cpp::Label *status = libraryStatusLayout->AddChild(new Label(_T("Library status: ")));
win32cpp::Label *status = libraryStatusLayout->AddChild(new Label(_(_T("Library status"))));
status->SetFont(boldFont);
this->libraryStatus = libraryStatusLayout->AddChild(new Label());
@ -101,8 +101,8 @@ void SettingsView::OnCreated()
// pathButtons layout
this->addPathButton = pathButtonsLayout->AddChild(new Button(_T("Add path")));
this->removePathButton = pathButtonsLayout->AddChild(new Button(_T("Remove path")));
this->addPathButton = pathButtonsLayout->AddChild(new Button(_(_T("Add path"))));
this->removePathButton = pathButtonsLayout->AddChild(new Button(_(_T("Remove path"))));
this->addPathButton->Resize(90, 24);
this->removePathButton->Resize(90, 24);

View File

@ -82,7 +82,7 @@ void SourcesController::OnModelCategoryAdded(CategoryRef category)
this->listController->Model()->AddCategory(category);
// TEMP HACK
if (category->Caption() == _T("View"))
if (category->Caption() == _(_T("View")))
{
this->listController->Model()->SelectedRowChanged(1);
}

View File

@ -99,7 +99,7 @@ public: static SourcesItemRef Create(musik::core::LibraryPtr library)
return SourcesItemRef(new BrowseItem(library));
}
public: virtual uistring Caption() { return _T("Browse"); }
public: virtual uistring Caption() { return _(_T("Browse")); }
public: virtual Window* View()
{
return &this->view;
@ -129,7 +129,7 @@ public: static SourcesItemRef Create(musik::core::LibraryPtr library)
return SourcesItemRef(new NowPlayingItem(library));
}
public: virtual uistring Caption() { return _T("Now Playing"); }
public: virtual uistring Caption() { return _(_T("Now Playing")); }
public: virtual Window* View()
{
return &this->view;
@ -160,7 +160,7 @@ public: static SourcesItemRef Create(musik::core::LibraryPtr library)
return SourcesItemRef(new SettingsItem(library));
}
public: virtual uistring Caption() { return _T("Settings"); }
public: virtual uistring Caption() { return _(_T("Settings")); }
public: virtual Window* View()
{
return &this->view;
@ -182,17 +182,17 @@ typedef SourcesListModel::CategoryRef CategoryRef;
void SourcesModel::Load()
{
CategoryRef viewCategory(new Category(_T("View")));
CategoryRef viewCategory(new Category(_(_T("View"))));
viewCategory->Add(BrowseItem::Create(this->library));
viewCategory->Add(NowPlayingItem::Create(this->library));
viewCategory->Add(SettingsItem::Create(this->library));
this->AddCategory(viewCategory);
CategoryRef playlistCategory(new Category(_T("Playlists")));
playlistCategory->Add(DummyItem::Create(_T("Playlist 1")));
playlistCategory->Add(DummyItem::Create(_T("Playlist 2")));
playlistCategory->Add(DummyItem::Create(_T("Dynamic Playlist 3")));
playlistCategory->Add(DummyItem::Create(_T("Dynamic Playlist 4")));
CategoryRef playlistCategory(new Category(_(_T("Playlists"))));
playlistCategory->Add(DummyItem::Create(_(_T("Playlist 1"))));
playlistCategory->Add(DummyItem::Create(_(_T("Playlist 2"))));
playlistCategory->Add(DummyItem::Create(_(_T("Dynamic Playlist 3"))));
playlistCategory->Add(DummyItem::Create(_(_T("Dynamic Playlist 4"))));
this->AddCategory(playlistCategory);
}

View File

@ -80,7 +80,7 @@ void SourcesView::OnListViewCreated(Window* window)
Size clientSize = this->listView->ClientSize();
this->mainColumn = Column::Create(_T("Sources"), clientSize.width, TextAlignCenter);
this->mainColumn = Column::Create(_(_T("Sources")), clientSize.width, TextAlignCenter);
this->listView->AddColumn(this->mainColumn);
this->listView->Resized.connect(this, &SourcesView::OnListViewResized);

View File

@ -77,13 +77,13 @@ void TracklistController::OnViewCreated(Window* window)
typedef ListView::Column Column;
ListView* listView = this->view.listView;
this->AddColumn(_T("Track"),"track", 50);
this->AddColumn(_T("Title"),"title", 200);
this->AddColumn(_T("Artist"),"visual_artist", 100);
this->AddColumn(_T("Album"),"album", 100);
this->AddColumn(_T("Genre"),"visual_genre", 75);
this->AddColumn(_T("Duration"),"duration", 50);
this->AddColumn(_T("BPM"),"bpm", 75);
this->AddColumn(_(_T("Track")),"track", 50);
this->AddColumn(_(_T("Title")),"title", 200);
this->AddColumn(_(_T("Artist")),"visual_artist", 100);
this->AddColumn(_(_T("Album")),"album", 100);
this->AddColumn(_(_T("Genre")),"visual_genre", 75);
this->AddColumn(_(_T("Duration")),"duration", 50);
this->AddColumn(_(_T("BPM")),"bpm", 75);
int itemHeight = listView->RowHeight();
listView->SetRowHeight(max(itemHeight, 17));

View File

@ -53,11 +53,20 @@ using namespace musik::cube;
void TracklistInfoView::OnCreated()
{
this->AddChild(new Label(_T("Tracks: ")));
uistring
tracksCaption = _(_T("Tracks")),
durationCaption = _(_T("Duration")),
sizeCaption = _(_T("Size"));
tracksCaption += _T(": ");
durationCaption = _T(" ") + durationCaption + _T(": ");
sizeCaption = _T(" ") + sizeCaption + _T(": ");
this->AddChild(new Label(tracksCaption.c_str()));
this->trackCountLabel = this->AddChild(new Label(_T("0")));
this->AddChild(new Label(_T(" Duration: ")));
this->AddChild(new Label(durationCaption.c_str()));
this->durationLabel = this->AddChild(new Label(_T("0:00")));
this->AddChild(new Label(_T(" Size: ")));
this->AddChild(new Label(sizeCaption.c_str()));
this->sizeLabel = this->AddChild(new Label(_T("0 MB")));
FontRef boldFont(Font::Create(_T(""), -1, true));

View File

@ -249,7 +249,7 @@ void TransportController::OnPlaybackPaused()
}
this->paused = true;
this->transportView.playButton->SetCaption(_T("Resume"));
this->transportView.playButton->SetCaption(_(_T("Resume")));
}
void TransportController::OnPlaybackResumed()
@ -261,7 +261,7 @@ void TransportController::OnPlaybackResumed()
}
this->paused = false;
this->transportView.playButton->SetCaption(_T("Pause"));
this->transportView.playButton->SetCaption(_(_T("Pause")));
}
win32cpp::uistring TransportController::FormatTime(unsigned long ms)

View File

@ -65,10 +65,10 @@ void TransportView::OnCreated()
topRowLayout->SetDefaultChildFill(false);
topRowLayout->SetDefaultChildAlignment(ChildAlignMiddle);
this->prevButton = topRowLayout->AddChild(new Button(_T("Prev")));
this->playButton = topRowLayout->AddChild(new Button(_T("Play")));
this->stopButton = topRowLayout->AddChild(new Button(_T("Stop")));
this->nextButton = topRowLayout->AddChild(new Button(_T("Next")));
this->prevButton = topRowLayout->AddChild(new Button(_(_T("Prev"))));
this->playButton = topRowLayout->AddChild(new Button(_(_T("Play"))));
this->stopButton = topRowLayout->AddChild(new Button(_(_T("Stop"))));
this->nextButton = topRowLayout->AddChild(new Button(_(_T("Next"))));
//
this->prevButton->Resize(50, 28);
this->playButton->Resize(50, 28);
@ -81,10 +81,14 @@ void TransportView::OnCreated()
//
LinearLayout* nowPlayingLayout = new LinearLayout(LinearColumnLayout);
//
nowPlayingLayout->AddChild(new Label(_T("Now playing ")));
this->titleLabel = nowPlayingLayout->AddChild(new Label(_T("Song Title")));
nowPlayingLayout->AddChild(new Label(_T(" by ")));
this->artistLabel = nowPlayingLayout->AddChild(new Label(_T("Artist Name")));
uistring nowPlayingCaption = _(_T("Now playing"));
nowPlayingCaption += _T(" ");
nowPlayingLayout->AddChild(new Label(nowPlayingCaption.c_str()));
this->titleLabel = nowPlayingLayout->AddChild(new Label(_(_T("Song Title"))));
uistring byCaption = _(_T("by"));
byCaption = _T(" ") + byCaption + _T(" ");
nowPlayingLayout->AddChild(new Label(byCaption.c_str()));
this->artistLabel = nowPlayingLayout->AddChild(new Label(_(_T("Artist Name"))));
//
this->titleLabel->SetFont(boldFont);
this->artistLabel->SetFont(boldFont);

View File

@ -50,11 +50,28 @@ using namespace musik::cube;
int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPTSTR commandLine, int showCommand)
{
// Initialize locale
try {
Locale::Instance()->SetLocaleDirectory(_T("locales"));
}
catch(win32cpp::Win32Exception& e) {
MessageBox(NULL, WidenString(e.Message()).c_str(), _T("Error while initializing locale"), MB_ICONERROR | MB_OK);
return -1;
}
catch(Exception& e) {
MessageBox(NULL, WidenString(e.Message()).c_str(), _T("Error while initializing locale"), MB_ICONERROR | MB_OK);
return -2;
}
if(!Locale::Instance()->LoadConfig(_T("english"))) {
MessageBox(NULL, _T("Cannot load config!"), _T("Error while initializing locale"), MB_ICONERROR | MB_OK);
return -3;
}
// Initialize the main application (mC2.exe)
Application::Initialize(instance, prevInstance, commandLine, showCommand);
// Create the main window and its controller
TopLevelWindow mainWindow(_T("mC2"));
TopLevelWindow mainWindow(_T("musikCube 2"));
MainWindowController mainController(mainWindow);
// Initialize and show the main window, and run the event loop.

View File

@ -70,11 +70,14 @@
#include <win32cpp/Types.hpp>
#include <win32cpp/WindowGeometry.hpp>
#include <win32cpp/Exception.hpp>
#include <win32cpp/Win32Exception.hpp>
#include <win32cpp/Utility.hpp>
#include <win32cpp/Container.hpp>
#include <win32cpp/Font.hpp>
#include <win32cpp/Menu.hpp>
#include <win32cpp/Window.hpp>
#include <win32cpp/Application.hpp>
#include <win32cpp/TopLevelWindow.hpp>
#include <win32cpp/Locale.hpp>
//////////////////////////////////////////////////////////////////////////////

View File

@ -67,7 +67,7 @@ void SyncPathController::OnViewCreated(Window* window){
Size clientSize = this->listView.ClientSize();
this->mainColumn = Column::Create(_T("Path"), clientSize.width);
this->mainColumn = Column::Create(_(_T("Path")), clientSize.width);
this->listView.AddColumn(this->mainColumn);
this->listView.EnableColumnResizing(false);

View File

@ -97,7 +97,7 @@ public:
/*dtor*/ ~Locale();
};
#define _(ORIGINALTEXT) (win32cpp::Locale::Instance()->Translate(ORIGINALTEXT))
#define _(ORIGINALTEXT) (win32cpp::Locale::Instance()->Translate(ORIGINALTEXT).c_str())
//////////////////////////////////////////////////////////////////////////////