From 5fb5ea91bf4e97352f1f5e9614794e4137b29f15 Mon Sep 17 00:00:00 2001 From: martii Date: Tue, 6 May 2014 12:28:25 +0200 Subject: [PATCH] gui/infoviewer, gui/eventlist: localization fixes --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + src/gui/eventlist.cpp | 9 +++++---- src/gui/eventlist.h | 2 ++ src/gui/infoviewer.cpp | 2 +- src/gui/moviebrowser.cpp | 9 +++++---- src/system/locals.h | 1 + src/system/locals_intern.h | 1 + 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 30f41b13a..c96d8a8db 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -652,6 +652,7 @@ imageinfo.kernel Kernel: imageinfo.license Lizenz imageinfo.vcs Git: imageinfo.version Version: +in in inetradio.name Internetradio infoviewer.epgnotload Informationen noch nicht geladen... infoviewer.epgwait Warte auf EPG-Informationen... diff --git a/data/locale/english.locale b/data/locale/english.locale index 161f0e975..07b43a090 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -652,6 +652,7 @@ imageinfo.kernel Kernel: imageinfo.license License imageinfo.vcs Git: imageinfo.version Version: +in in inetradio.name Internetradio infoviewer.epgnotload EPG not loaded.... infoviewer.epgwait waiting for EPG... diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 5b0815f69..e8ca2f0e8 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -271,9 +271,10 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c int h2 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getHeight(); fheight2 = std::max( h1, h2 ); } + unit_short_minute = g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE); fheight = fheight1 + fheight2 + 2; - fwidth1 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getRenderWidth("DDD, 00:00, "); - fwidth2 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth("[999 min] "); + fwidth1 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getRenderWidth("DDD, :, ") + 4 * g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getMaxDigitWidth(); + fwidth2 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth("[ ] ") + 3 * g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getMaxDigitWidth() + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth(unit_short_minute); listmaxshow = (height-theight-iheight-0)/fheight; height = theight+iheight+0+listmaxshow*fheight; // recalc height @@ -766,7 +767,7 @@ void CNeutrinoEventList::paintItem(unsigned int pos, t_channel_id channel_idI) datetime2_str += CServiceManager::getInstance()->GetServiceName(channel); } - snprintf(tmpstr,sizeof(tmpstr), "[%d min]", evtlist[curpos].duration / 60 ); + snprintf(tmpstr,sizeof(tmpstr), "[%d %s]", evtlist[curpos].duration / 60, unit_short_minute); duration_str = tmpstr; } @@ -778,7 +779,7 @@ void CNeutrinoEventList::paintItem(unsigned int pos, t_channel_id channel_idI) if ( (seit> 0) && (seit<100) && (duration_str.length()!=0) ) { char beginnt[100]; - snprintf((char*) &beginnt,sizeof(beginnt), "in %d min", seit); + snprintf(beginnt, sizeof(beginnt), "%s %d %s", g_Locale->getText(LOCALE_IN), seit, unit_short_minute); int w = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth(beginnt) + 10; g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x+width-fwidth2-5- 20- w, ypos+ fheight1+3, fwidth2, beginnt, color); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 96f79265b..6f724a354 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -107,6 +107,8 @@ class CNeutrinoEventList event_id_t item_event_ID; CComponentsText *cc_infozone; + const char * unit_short_minute; + void paintItem(unsigned pos, t_channel_id channel_id = 0); void paintDescription(int index); void paint(t_channel_id channel_id = 0); diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 164868088..a02dc0f11 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1671,7 +1671,7 @@ void CInfoViewer::show_Data (bool calledFromEvent) int rest = (info_CurrentNext.current_zeit.dauer / 60) - seit; if (jetzt < info_CurrentNext.current_zeit.startzeit) { runningPercent = 0; - snprintf (runningRest, sizeof(runningRest), "in %d %s", seit, unit_short_minute); //FIXME + snprintf (runningRest, sizeof(runningRest), "%s %d %s", g_Locale->getText(LOCALE_IN), seit, unit_short_minute); } else { runningPercent = (jetzt - info_CurrentNext.current_zeit.startzeit) * 100 / info_CurrentNext.current_zeit.dauer; if (runningPercent > 100) diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index a2207e958..ec01a312e 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -3235,6 +3235,7 @@ bool CMovieBrowser::showMenu(MI_MOVIE_INFO* /*movie_info*/) int CMovieBrowser::showStartPosSelectionMenu(void) // P2 { + const char *unit_short_minute = g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE); //TRACE("[mb]->showStartPosSelectionMenu\r\n"); int pos = -1; int result = 0; @@ -3243,10 +3244,10 @@ int CMovieBrowser::showStartPosSelectionMenu(void) // P2 if(m_movieSelectionHandler == NULL) return(result); - char start_pos[13]; snprintf(start_pos, 12,"%3d min",m_movieSelectionHandler->bookmarks.start/60); - char play_pos[13]; snprintf(play_pos, 12,"%3d min",m_movieSelectionHandler->bookmarks.lastPlayStop/60); + char start_pos[32]; snprintf(start_pos, sizeof(start_pos), "%3d %s",m_movieSelectionHandler->bookmarks.start/60, unit_short_minute); + char play_pos[32]; snprintf(play_pos, sizeof(play_pos), "%3d %s",m_movieSelectionHandler->bookmarks.lastPlayStop/60, unit_short_minute); - char book[MI_MOVIE_BOOK_USER_MAX][20]; + char book[MI_MOVIE_BOOK_USER_MAX][32]; CMenuWidgetSelection startPosSelectionMenu(LOCALE_MOVIEBROWSER_HEAD , NEUTRINO_ICON_MOVIEPLAYER); startPosSelectionMenu.enableFade(false); @@ -3276,7 +3277,7 @@ int CMovieBrowser::showStartPosSelectionMenu(void) // P2 else position[menu_nr] = m_movieSelectionHandler->bookmarks.user[i].pos + m_movieSelectionHandler->bookmarks.user[i].length; - snprintf(book[i], 19,"%5d min",position[menu_nr]/60); + snprintf(book[i], sizeof(book[i]),"%5d %s",position[menu_nr]/60, unit_short_minute); startPosSelectionMenu.addItem(new CMenuForwarder (m_movieSelectionHandler->bookmarks.user[i].name.c_str(), true, book[i])); menu_nr++; } diff --git a/src/system/locals.h b/src/system/locals.h index 69c092e1b..c0665a000 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -679,6 +679,7 @@ typedef enum LOCALE_IMAGEINFO_LICENSE, LOCALE_IMAGEINFO_VCS, LOCALE_IMAGEINFO_VERSION, + LOCALE_IN, LOCALE_INETRADIO_NAME, LOCALE_INFOVIEWER_EPGNOTLOAD, LOCALE_INFOVIEWER_EPGWAIT, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 25770efe9..c129e5cb9 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -679,6 +679,7 @@ const char * locale_real_names[] = "imageinfo.license", "imageinfo.vcs", "imageinfo.version", + "in", "inetradio.name", "infoviewer.epgnotload", "infoviewer.epgwait",