From 09d7cd9de61f9135e6f97e5632ff21eb21f1f2d5 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac <teo@kde.org> Date: Thu, 7 May 2015 16:10:04 +0200 Subject: [PATCH] Add translationsPathPrefix to Branding. --- src/libcalamaresui/Branding.cpp | 17 ++++++++++++++++- src/libcalamaresui/Branding.h | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 1a790b0e26..ebfb94d9d8 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -1,6 +1,6 @@ /* === This file is part of Calamares - <http://github.com/calamares> === * - * Copyright 2014, Teo Mrnjavac <teo@kde.org> + * Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -172,6 +172,14 @@ Branding::Branding( const QString& brandingFilePath, { cDebug() << "WARNING: YAML parser error " << e.what(); } + + QDir translationsDir( componentDir.filePath( "lang" ) ); + if ( !translationsDir.exists() ) + cDebug() << "WARNING: the selected branding component does not ship translations."; + m_translationsPathPrefix = translationsDir.absolutePath(); + m_translationsPathPrefix.append( QString( "%1calamares-%2" ) + .arg( QDir::separator() ) + .arg( m_componentName ) ); } else { @@ -205,6 +213,13 @@ Branding::componentDirectory() const } +QString +Branding::translationsPathPrefix() const +{ + return m_translationsPathPrefix; +} + + QString Branding::string( Branding::StringEntry stringEntry ) const { diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index 1c43c58327..9fc465ec4b 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -1,6 +1,6 @@ /* === This file is part of Calamares - <http://github.com/calamares> === * - * Copyright 2014, Teo Mrnjavac <teo@kde.org> + * Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,6 +72,7 @@ public: QString descriptorPath() const; QString componentName() const; QString componentDirectory() const; + QString translationsPathPrefix() const; QString string( Branding::StringEntry stringEntry ) const; QString styleString( Branding::StyleEntry styleEntry ) const; @@ -101,6 +102,7 @@ private: QMap< QString, QString > m_images; QMap< QString, QString > m_style; QString m_slideshowPath; + QString m_translationsPathPrefix; }; } -- GitLab