diff --git a/bin/debug/locales/english.ini b/bin/debug/locales/english.ini new file mode 100644 index 000000000..645c59d2d --- /dev/null +++ b/bin/debug/locales/english.ini @@ -0,0 +1,3 @@ +[config] +name=English +locale_identifier=0x0409 diff --git a/bin/debug/locales/german.ini b/bin/debug/locales/german.ini new file mode 100644 index 000000000..86bf92a48 --- /dev/null +++ b/bin/debug/locales/german.ini @@ -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 diff --git a/docs/win32cpp.doxygen b/docs/win32cpp.doxygen index cbc4ffa80..afd79677c 100644 --- a/docs/win32cpp.doxygen +++ b/docs/win32cpp.doxygen @@ -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 diff --git a/src/cube/BrowseView.cpp b/src/cube/BrowseView.cpp index a9aeabc4a..1869fe06d 100644 --- a/src/cube/BrowseView.cpp +++ b/src/cube/BrowseView.cpp @@ -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); diff --git a/src/cube/MainMenuController.cpp b/src/cube/MainMenuController.cpp index a4488b3ca..f3a159ba4 100644 --- a/src/cube/MainMenuController.cpp +++ b/src/cube/MainMenuController.cpp @@ -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(); diff --git a/src/cube/MainWindowController.cpp b/src/cube/MainWindowController.cpp index dd76acb78..e3d9f8a2e 100644 --- a/src/cube/MainWindowController.cpp +++ b/src/cube/MainWindowController.cpp @@ -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); diff --git a/src/cube/SettingsView.cpp b/src/cube/SettingsView.cpp index 876e1a92e..21ed6940d 100644 --- a/src/cube/SettingsView.cpp +++ b/src/cube/SettingsView.cpp @@ -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); diff --git a/src/cube/SourcesController.cpp b/src/cube/SourcesController.cpp index 313f6d933..e74bbe95b 100644 --- a/src/cube/SourcesController.cpp +++ b/src/cube/SourcesController.cpp @@ -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); } diff --git a/src/cube/SourcesModel.cpp b/src/cube/SourcesModel.cpp index 3ba047138..7defce5aa 100644 --- a/src/cube/SourcesModel.cpp +++ b/src/cube/SourcesModel.cpp @@ -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); } diff --git a/src/cube/SourcesView.cpp b/src/cube/SourcesView.cpp index 1d9ed869c..72df03ac8 100644 --- a/src/cube/SourcesView.cpp +++ b/src/cube/SourcesView.cpp @@ -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); diff --git a/src/cube/TracklistController.cpp b/src/cube/TracklistController.cpp index f4105faff..6d3cbad64 100644 --- a/src/cube/TracklistController.cpp +++ b/src/cube/TracklistController.cpp @@ -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)); diff --git a/src/cube/TracklistInfoView.cpp b/src/cube/TracklistInfoView.cpp index da10440e7..a745bcd50 100644 --- a/src/cube/TracklistInfoView.cpp +++ b/src/cube/TracklistInfoView.cpp @@ -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)); diff --git a/src/cube/TransportController.cpp b/src/cube/TransportController.cpp index b565de9ec..b264437a6 100644 --- a/src/cube/TransportController.cpp +++ b/src/cube/TransportController.cpp @@ -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) diff --git a/src/cube/TransportView.cpp b/src/cube/TransportView.cpp index a6d8f2047..8c42ae9a7 100644 --- a/src/cube/TransportView.cpp +++ b/src/cube/TransportView.cpp @@ -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); diff --git a/src/cube/main.cpp b/src/cube/main.cpp index 278e8ec5f..341eac558 100644 --- a/src/cube/main.cpp +++ b/src/cube/main.cpp @@ -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. diff --git a/src/cube/pch.hpp b/src/cube/pch.hpp index f19941bd0..4a00a856f 100644 --- a/src/cube/pch.hpp +++ b/src/cube/pch.hpp @@ -70,11 +70,14 @@ #include #include #include +#include +#include #include #include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/src/cube/settings/SyncPathController.cpp b/src/cube/settings/SyncPathController.cpp index bad31338e..a8799e2fb 100644 --- a/src/cube/settings/SyncPathController.cpp +++ b/src/cube/settings/SyncPathController.cpp @@ -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); diff --git a/src/win32cpp/Locale.hpp b/src/win32cpp/Locale.hpp index 27f8b37d2..b9c12bb74 100644 --- a/src/win32cpp/Locale.hpp +++ b/src/win32cpp/Locale.hpp @@ -97,7 +97,7 @@ public: /*dtor*/ ~Locale(); }; -#define _(ORIGINALTEXT) (win32cpp::Locale::Instance()->Translate(ORIGINALTEXT)) +#define _(ORIGINALTEXT) (win32cpp::Locale::Instance()->Translate(ORIGINALTEXT).c_str()) //////////////////////////////////////////////////////////////////////////////