Cleanup namespace usage for boost::locale

In a previous commit I wrongly believed xgettext might not find
our strings if we used the fully namespaced boost::locale::translate or
aliased bl::translate instead of just translate. However that's
wrong, so I have changed the code to always use bl::translate.
This commit is contained in:
Geert Janssens 2018-02-28 16:50:15 +01:00
parent b71c346ef5
commit ad1664604f
2 changed files with 19 additions and 20 deletions

View File

@ -67,7 +67,6 @@ extern "C"
#include <boost/locale.hpp>
namespace bl = boost::locale;
using namespace boost::locale;
#define MIN_COL_WIDTH 70
#define GNC_PREFS_GROUP "dialogs.import.csv"
@ -1947,9 +1946,10 @@ CsvImpTransAssist::assist_summary_page_prepare ()
gen.add_messages_path(gnc_path_get_datadir());
gen.add_messages_domain(PACKAGE);
auto text = std::string("<span size=\"medium\"><b>");
// FIXME Rather than passing a locale generator below we probably should set std::locale::global appropriately somewhere.
text += (bl::format (translate ("The transactions were imported from the file '{1}'.")) % m_file_name).str(gen(""));
auto text = std::string("<span size=\"medium\"><b>");
/* Translators: {1} will be replaced with a filename */
text += (bl::format (bl::translate ("The transactions were imported from file '{1}'.")) % m_file_name).str(gen(""));
text += "</b></span>";
gtk_label_set_markup (GTK_LABEL(summary_label), text.c_str());
}

View File

@ -78,7 +78,6 @@ extern "C" {
namespace bfs = boost::filesystem;
namespace bst = boost::system;
namespace bl = boost::locale;
using namespace boost::locale;
/**
* Scrubs a filename by changing "strange" chars (e.g. those that are not
@ -678,35 +677,35 @@ static std::string migrate_gnc_datahome()
/* Step 3: inform the user of additional changes */
if (full_copy || !succeeded.empty() || !conf_exist_vec.empty() || !failed.empty())
migration_msg << translate ("Notice") << std::endl << std::endl;
migration_msg << bl::translate ("Notice") << std::endl << std::endl;
if (full_copy)
{
migration_msg
<< translate ("Your gnucash metadata has been migrated.") << std::endl << std::endl
<< bl::translate ("Your gnucash metadata has been migrated .") << std::endl << std::endl
/* Translators: this refers to a directory name. */
<< translate ("Old location:") << " " << old_dir.string() << std::endl
<< bl::translate ("Old location:") << " " << old_dir.string() << std::endl
/* Translators: this refers to a directory name. */
<< translate ("New location:") << " " << gnc_userdata_home.string() << std::endl << std::endl
<< bl::translate ("New location:") << " " << gnc_userdata_home.string() << std::endl << std::endl
// Translators {1} will be replaced with the package name (typically Gnucash) at runtime
<< bl::format (translate ("If you no longer intend to run {1} 2.6.x or older on this system you can safely remove the old directory."))
<< bl::format (bl::translate ("If you no longer intend to run {1} 2.6.x or older on this system you can safely remove the old directory."))
% PACKAGE_NAME;
}
if (full_copy &&
(!succeeded.empty() || !conf_exist_vec.empty() || !failed.empty()))
migration_msg << std::endl << std::endl
<< translate ("In addition:");
<< bl::translate ("In addition:");
if (!succeeded.empty())
{
migration_msg << std::endl << std::endl;
if (full_copy)
migration_msg << bl::format (translate ("The following file has been copied to {1} instead:",
migration_msg << bl::format (bl::translate ("The following file has been copied to {1} instead:",
"The following files have been copied to {1} instead:",
succeeded.size())) % gnc_userconfig_home.string().c_str();
else
migration_msg << bl::format (translate ("The following file in {1} has been renamed:"))
migration_msg << bl::format (bl::translate ("The following file in {1} has been renamed:"))
% gnc_userconfig_home.string().c_str();
migration_msg << std::endl;
@ -716,7 +715,7 @@ static std::string migrate_gnc_datahome()
if (!conf_exist_vec.empty())
{
migration_msg << std::endl << std::endl
<< translate ("The following file has become obsolete and will be ignored:",
<< bl::translate ("The following file has become obsolete and will be ignored:",
"The following files have become obsolete and will be ignored:",
conf_exist_vec.size())
<< std::endl;
@ -726,7 +725,7 @@ static std::string migrate_gnc_datahome()
if (!failed.empty())
{
migration_msg << std::endl << std::endl
<< bl::format (translate ("The following file could not be moved to {1}:",
<< bl::format (bl::translate ("The following file could not be moved to {1}:",
"The following files could not be moved to {1}:",
failed.size())) % gnc_userconfig_home.string().c_str()
<< std::endl;