Bug 798657 - Import Summary language is wrong

Root cause is using boost::locale::translate because it ignores
the LANGUAGES environment variable and doesn't support different
values for LC_MESSAGES, LC_DATE, LC_MONETARY, and LC_NUMERIC.
That makes it impossible to configure a user environment that
presents translated strings in a different locale from the one
applied to formatting dates and numbers.

To correct this replace all use of boost::locale::translate
with GNU gettext.
This commit is contained in:
John Ralls
2022-12-16 15:25:59 -08:00
parent dd48a025d5
commit 091d4aff22
8 changed files with 60 additions and 59 deletions

View File

@@ -671,35 +671,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 << bl::translate ("Notice") << std::endl << std::endl;
migration_msg << _("Notice") << std::endl << std::endl;
if (full_copy)
{
migration_msg
<< bl::translate ("Your gnucash metadata has been migrated.") << std::endl << std::endl
<< _("Your gnucash metadata has been migrated.") << std::endl << std::endl
/* Translators: this refers to a directory name. */
<< bl::translate ("Old location:") << " " << old_dir.string() << std::endl
<< _("Old location:") << " " << old_dir.string() << std::endl
/* Translators: this refers to a directory name. */
<< bl::translate ("New location:") << " " << gnc_userdata_home.string() << std::endl << std::endl
<< _("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 (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."))
<< bl::format (std::string{_("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
<< bl::translate ("In addition:");
<< _("In addition:");
if (!succeeded.empty())
{
migration_msg << std::endl << std::endl;
if (full_copy)
migration_msg << bl::format (bl::translate ("The following file has been copied to {1} instead:",
migration_msg << bl::format (std::string{ngettext("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();
succeeded.size())}) % gnc_userconfig_home.string().c_str();
else
migration_msg << bl::format (bl::translate ("The following file in {1} has been renamed:"))
migration_msg << bl::format (std::string{_("The following file in {1} has been renamed:")})
% gnc_userconfig_home.string().c_str();
migration_msg << std::endl;
@@ -708,8 +708,8 @@ static std::string migrate_gnc_datahome()
}
if (!conf_exist_vec.empty())
{
migration_msg << std::endl << std::endl
<< bl::translate ("The following file has become obsolete and will be ignored:",
migration_msg << "\n\n"
<< ngettext("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;
@@ -719,9 +719,9 @@ static std::string migrate_gnc_datahome()
if (!failed.empty())
{
migration_msg << std::endl << std::endl
<< bl::format (bl::translate ("The following file could not be moved to {1}:",
<< bl::format (std::string{ngettext("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()
failed.size())}) % gnc_userconfig_home.string().c_str()
<< std::endl;
for (auto failed_file : failed)
migration_msg << "- " << failed_file << std::endl;