Skip to content

Commit

Permalink
respect overriden locale in helpviewer and fix link typo
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12536 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 20, 2009
1 parent f8abe9e commit 3f8c05a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/helpviewer/CMakeLists.txt
Expand Up @@ -79,7 +79,7 @@ IF (${QTVERSION} STRLESS "4.3.0")
)
ELSE (${QTVERSION} STRLESS "4.3.0")
TARGET_LINK_LIBRARIES(qgis_help
${QT_QTCORE_LIBRA}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTSVG_LIBRARY}
Expand Down
6 changes: 6 additions & 0 deletions src/helpviewer/main.cpp
Expand Up @@ -49,6 +49,12 @@ int main( int argc, char ** argv )
if ( myTranslationCode.isEmpty() )
{
myTranslationCode = QLocale::system().name();

QSettings settings;
if( settings.value( "locale/overrideFlag", false ).toBool() )
{
myTranslationCode = settings.value( "locale/userLocale", "en_US" ).toString();
}
}
QgsDebugMsg( QString( "Setting translation to %1/qgis_%2" ).arg( i18nPath ).arg( myTranslationCode ) );

Expand Down
11 changes: 9 additions & 2 deletions src/helpviewer/qgshelpviewer.cpp
Expand Up @@ -104,7 +104,14 @@ void QgsHelpViewer::loadContext( const QString &contextId )
* determine the locale and create the file name from
* the context id
*/
QString lang( QLocale::system().name() );
QString lang = QLocale::system().name();

QSettings settings;
if( settings.value( "locale/overrideFlag", false ).toBool() )
{
QLocale l( settings.value( "locale/userLocale", "en_US" ).toString() );
lang = l.name();
}
/*
* If the language isn't set on the system, assume en_US,
* otherwise we get the banner at the top of the help file
Expand All @@ -129,7 +136,7 @@ void QgsHelpViewer::loadContext( const QString &contextId )
// translate this for us message
if ( !lang.contains( "en_" ) )
{
helpContents = "<i>" + tr( "This help file is not available in your language. If you would like to translate it, please contact the QGIS development team." ) + "</i><hr />";
helpContents = "<i>" + tr( "This help file is not available in your language %1. If you would like to translate it, please contact the QGIS development team." ).arg( lang ) + "</i><hr />";
}
}
if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
Expand Down

0 comments on commit 3f8c05a

Please sign in to comment.