Improved localization

FossilOrigin-Name: ecfc352947256f0264047517f06a7e0e85b9acbd
This commit is contained in:
kostas
2012-11-23 02:57:25 +00:00
parent 0ed31413ca
commit c597870da9
9 changed files with 977 additions and 958 deletions

View File

@ -1777,7 +1777,7 @@ void MainWindow::on_actionAdd_triggered()
if(selection.empty())
return;
if(!FileActionDialog::run(this, tr("Add files"), tr("The following files will be added. Are you sure?"), selection))
if(!FileActionDialog::run(this, tr("Add files"), tr("The following files will be added.")+"\n"+tr("Are you sure?"), selection))
return;
// Do Add
@ -1802,7 +1802,7 @@ void MainWindow::on_actionDelete_triggered()
bool remove_local = false;
if(!FileActionDialog::run(this, tr("Remove files"), tr("The following files will be removed from the repository.\nAre you sure?"), all_files, tr("Also delete the local files"), &remove_local ))
if(!FileActionDialog::run(this, tr("Remove files"), tr("The following files will be removed from the repository.")+"\n"+tr("Are you sure?"), all_files, tr("Also delete the local files"), &remove_local ))
return;
if(!repo_files.empty())
@ -1834,7 +1834,7 @@ void MainWindow::on_actionRevert_triggered()
if(modified_files.empty())
return;
if(!FileActionDialog::run(this, tr("Revert files"), tr("The following files will be reverted. Are you sure?"), modified_files))
if(!FileActionDialog::run(this, tr("Revert files"), tr("The following files will be reverted.")+"\n"+tr("Are you sure?"), modified_files))
return;
// Do Revert
@ -1910,7 +1910,7 @@ void MainWindow::on_actionUndo_triggered()
if(res.length()>0 && res[0]=="No undo or redo is available")
return;
if(!FileActionDialog::run(this, tr("Undo"), tr("The following actions will be undone. Are you sure?"), res))
if(!FileActionDialog::run(this, tr("Undo"), tr("The following actions will be undone.")+"\n"+tr("Are you sure?"), res))
return;
// Do Undo
@ -1938,8 +1938,8 @@ void MainWindow::on_actionAbout_triggered()
"by Kostas Karanikolas\n"
"Released under the GNU GPL")+"\n\n"
+ fossil_ver +
tr("Icon-set by Deleket - Jojo Mendoza\n"
"Available under the CC Attribution Noncommercial No Derivate 3.0 License"));
tr("Icons by Deleket - Jojo Mendoza\n"
"Available under the CC Attribution Noncommercial No Derivative 3.0 License"));
}
//------------------------------------------------------------------------------
@ -1953,7 +1953,7 @@ void MainWindow::on_actionUpdate_triggered()
if(res.length()==0)
return;
if(!FileActionDialog::run(this, tr("Update"), tr("The following files will be updated. Are you sure?"), res))
if(!FileActionDialog::run(this, tr("Update"), tr("The following files will be updated.")+"\n"+tr("Are you sure?"), res))
return;
// Do Update
@ -2204,7 +2204,7 @@ void MainWindow::on_actionRenameFolder_triggered()
bool move_local = false;
if(!FileActionDialog::run(this, tr("Rename Folder"), tr("Renaming folder '%0' to '%1'\n"
"The following files will be moved in the repository. Are you sure?").arg(old_path, new_path),
"The following files will be moved in the repository.").arg(old_path, new_path)+"\n"+tr("Are you sure?"),
operations,
tr("Also move the workspace files"), &move_local)) {
return;
@ -2355,7 +2355,7 @@ void MainWindow::on_actionApplyStash_triggered()
getStashViewSelection(stashes);
bool delete_stashes = false;
if(!FileActionDialog::run(this, tr("Apply Stash"), tr("The following stashes will be applied. Are you sure?"), stashes, tr("Delete after applying"), &delete_stashes))
if(!FileActionDialog::run(this, tr("Apply Stash"), tr("The following stashes will be applied.")+"\n"+tr("Are you sure?"), stashes, tr("Delete after applying"), &delete_stashes))
return;
// Apply stashes
@ -2396,7 +2396,7 @@ void MainWindow::on_actionDeleteStash_triggered()
if(stashes.empty())
return;
if(!FileActionDialog::run(this, tr("Delete Stashes"), tr("The following stashes will be deleted. Are you sure?"), stashes))
if(!FileActionDialog::run(this, tr("Delete Stashes"), tr("The following stashes will be deleted.")+"\n"+tr("Are you sure?"), stashes))
return;
// Delete stashes

View File

@ -21,7 +21,7 @@ QString SettingsDialog::SelectExe(QWidget *parent, const QString &description)
#endif
QString path = QFileDialog::getOpenFileName(
parent,
tr("Select %1").arg(description),
description,
QString(),
filter,
&filter);
@ -54,10 +54,11 @@ SettingsDialog::SettingsDialog(QWidget *parent, Settings &_settings) :
foreach(const LangMap &m, langMap)
ui->cmbActiveLanguage->addItem(m.name);
QString lang = settings->GetValue(FUEL_SETTING_LANGUAGE).toString();
// Select current language
ui->cmbActiveLanguage->setCurrentIndex(
ui->cmbActiveLanguage->findText(
LangIdToName(settings->GetValue(FUEL_SETTING_LANGUAGE).toString())));
LangIdToName(lang)));
// Repo Settings
ui->lineGDiffCommand->setText(QDir::toNativeSeparators(settings->GetFossilValue(FOSSIL_SETTING_GDIFF_CMD).toString()));
@ -108,7 +109,7 @@ void SettingsDialog::on_buttonBox_accepted()
//-----------------------------------------------------------------------------
void SettingsDialog::on_btnSelectFossil_clicked()
{
QString path = SelectExe(this, tr("Fossil executable"));
QString path = SelectExe(this, tr("Select Fossil executable"));
if(!path.isEmpty())
ui->lineFossilPath->setText(QDir::toNativeSeparators(path));
}
@ -116,7 +117,7 @@ void SettingsDialog::on_btnSelectFossil_clicked()
//-----------------------------------------------------------------------------
void SettingsDialog::on_btnSelectFossilGDiff_clicked()
{
QString path = SelectExe(this, tr("Graphical Diff application"));
QString path = SelectExe(this, tr("Select Graphical Diff application"));
if(!path.isEmpty())
ui->lineGDiffCommand->setText(QDir::toNativeSeparators(path));
}
@ -124,7 +125,7 @@ void SettingsDialog::on_btnSelectFossilGDiff_clicked()
//-----------------------------------------------------------------------------
void SettingsDialog::on_btnSelectGMerge_clicked()
{
QString path = SelectExe(this, tr("Graphical Merge application"));
QString path = SelectExe(this, tr("Select Graphical Merge application"));
if(!path.isEmpty())
ui->lineGMergeCommand->setText(QDir::toNativeSeparators(path));
}
@ -191,7 +192,7 @@ Settings::Settings(bool portableMode) : store(0)
if(!HasValue(FUEL_SETTING_FILE_DBLCLICK))
SetValue(FUEL_SETTING_FILE_DBLCLICK, 0);
if(!HasValue(FUEL_SETTING_LANGUAGE))
if(!HasValue(FUEL_SETTING_LANGUAGE) && SupportsLang(QLocale::system().name()))
SetValue(FUEL_SETTING_LANGUAGE, QLocale::system().name());
ApplyEnvironment();
@ -251,3 +252,11 @@ void Settings::SetFossilValue(const QString &name, const QVariant &value)
Q_ASSERT(it!=Mappings.end());
it->Value = value;
}
//-----------------------------------------------------------------------------
bool Settings::SupportsLang(const QString &langId) const
{
QString locale_path = QString(":intl/intl/%0.qm").arg(langId);
QResource res(locale_path);
return res.isValid();
}

View File

@ -50,20 +50,22 @@ struct Settings
typedef QMap<QString, Setting> mappings_t;
Settings(bool portableMode = false);
~Settings();
void ApplyEnvironment();
Settings(bool portableMode = false);
~Settings();
void ApplyEnvironment();
// App configuration access
class QSettings * GetStore() { return store; }
bool HasValue(const QString &name) const; // store->contains(FUEL_SETTING_FOSSIL_PATH)
const QVariant GetValue(const QString &name); // settings.store->value
void SetValue(const QString &name, const QVariant &value); // settings.store->value
class QSettings * GetStore() { return store; }
bool HasValue(const QString &name) const; // store->contains(FUEL_SETTING_FOSSIL_PATH)
const QVariant GetValue(const QString &name); // settings.store->value
void SetValue(const QString &name, const QVariant &value); // settings.store->value
// Fossil configuration access
QVariant & GetFossilValue(const QString &name);
void SetFossilValue(const QString &name, const QVariant &value);
mappings_t & GetMappings() { return Mappings; }
QVariant & GetFossilValue(const QString &name);
void SetFossilValue(const QString &name, const QVariant &value);
mappings_t & GetMappings() { return Mappings; }
bool SupportsLang(const QString &langId) const;
private:
mappings_t Mappings;