Commit b0a17083 authored by Murray Cumming's avatar Murray Cumming
Browse files

Use Glib::ustring::compose() instead of concatenation for translatable strings.

* glom/bakery/dialog_offersave.cc:
* glom/import_csv/dialog_import_csv.cc:
* glom/mode_design/fields/dialog_fieldcalculation.cc:
* glom/mode_design/layout/combobox_relationship.cc:
* glom/mode_design/layout/dialog_layout_details.cc:
* glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc:
* glom/navigation/box_tables.cc:
* glom/utils_ui.cc: Let translators arrange built strings.
parent 4229dc56
2011-10-13 Murray Cumming <murrayc@murrayc.com>
Use Glib::ustring::compose() instead of concatenation for translatable strings.
* glom/bakery/dialog_offersave.cc:
* glom/import_csv/dialog_import_csv.cc:
* glom/mode_design/fields/dialog_fieldcalculation.cc:
* glom/mode_design/layout/combobox_relationship.cc:
* glom/mode_design/layout/dialog_layout_details.cc:
* glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc:
* glom/navigation/box_tables.cc:
* glom/utils_ui.cc: Let translators arrange built strings.
2011-10-13 Ben Konrath <ben@bagu.org>
Add example document to test field formatting.
......
......@@ -29,7 +29,11 @@ namespace
{
Glib::ustring message = _("This document has unsaved changes. Would you like to save the document?");
if(!file_uri.empty())
message += _("\n\nDocument:\n") + Glib::filename_display_basename(file_uri); //TODO: Can we use filename_display_basename() with a URI?
{
message += "\n\n";
message += Glib::ustring::compose(_("Document:\n%1"), Glib::filename_display_basename(file_uri)); //TODO: Can we use filename_display_basename() with a URI?
}
return message;
}
}
......
......@@ -739,7 +739,7 @@ void Dialog_Import_CSV::on_parser_file_read_error(const Glib::ustring& error_mes
void Dialog_Import_CSV::on_parser_have_display_name(const Glib::ustring& display_name)
{
set_title(_("Import From CSV File: ") + display_name);
set_title( Glib::ustring::compose(_("Import From CSV File: %1"), display_name) );
}
void Dialog_Import_CSV::on_parser_state_changed()
......
......@@ -141,9 +141,9 @@ void Dialog_FieldCalculation::on_button_test()
error_message);
if(error_message.empty())
Utils::show_ok_dialog(_("Calculation result"), _("The result of the calculation is:\n") + value.to_string(), *this, Gtk::MESSAGE_INFO);
Utils::show_ok_dialog(_("Calculation result"), Glib::ustring::compose(_("The result of the calculation is:\n%1"), value.to_string()), *this, Gtk::MESSAGE_INFO);
else
Utils::show_ok_dialog(_("Calculation failed"), _("The calculation failed with this error:\n") + error_message, *this, Gtk::MESSAGE_ERROR);
Utils::show_ok_dialog( _("Calculation failed"), Glib::ustring::compose(_("The calculation failed with this error:\n%s"), error_message), *this, Gtk::MESSAGE_ERROR);
//Show what fields would trigger the recalculation:
sharedptr<Field> temp = sharedptr<Field>::create();
......
......@@ -264,11 +264,11 @@ void ComboBox_Relationship::on_cell_data_fromfield(const Gtk::TreeModel::const_i
{
sharedptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
if(parent_relationship)
m_renderer_fromfield->set_property("text", _(" Via: ") + parent_relationship->get_title() + "::" + relationship->get_from_field());
m_renderer_fromfield->set_property("text", Glib::ustring::compose(_(" Via: %1::%2"), parent_relationship->get_title(), relationship->get_from_field()));
}
else
{
m_renderer_fromfield->set_property("text", _(" Via: ") + relationship->get_to_field());
m_renderer_fromfield->set_property("text", Glib::ustring::compose(_(" Via: %1"), relationship->get_to_field()));
}
}
else
......
......@@ -1118,9 +1118,9 @@ void Dialog_Layout_Details::on_cell_data_name(Gtk::CellRenderer* renderer, const
{
sharedptr<LayoutItem_CalendarPortal> layout_calendar = sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(layout_portal);
if(layout_calendar)
markup = _("Related Calendar: ") + layout_portal->get_relationship_name();
markup = Glib::ustring::compose(_("Related Calendar: %1"), layout_portal->get_relationship_name());
else
markup = _("Related List: ") + layout_portal->get_relationship_name();
markup = Glib::ustring::compose(_("Related List: %1"), layout_portal->get_relationship_name());
}
else
{
......@@ -1137,7 +1137,7 @@ void Dialog_Layout_Details::on_cell_data_name(Gtk::CellRenderer* renderer, const
sharedptr<LayoutItem_Field> layout_item_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
if(layout_item_field)
{
markup = _("Field: ") + layout_item_field->get_layout_display_name(); //TODO: Put this all in a sprintf-style string so it can be translated properly.
markup = Glib::ustring::compose(_("Field: %1"), layout_item_field->get_layout_display_name());
//Just for debugging:
//if(!row[m_model_items->m_columns.m_col_editable])
......
......@@ -134,7 +134,7 @@ void Dialog_ButtonScript::on_button_test_script()
error_message);
if(!error_message.empty())
Utils::show_ok_dialog(_("Calculation failed"), _("The calculation failed with this error:\n") + error_message, *this, Gtk::MESSAGE_ERROR);
Utils::show_ok_dialog(_("Calculation failed"), Glib::ustring::compose(_("The calculation failed with this error:\n%1"), error_message), *this, Gtk::MESSAGE_ERROR);
}
} //namespace Glom
......@@ -300,11 +300,11 @@ void Box_Tables::on_adddel_Delete(const Gtk::TreeModel::iterator& rowStart, cons
else
{
//Ask the user to confirm:
Glib::ustring strMsg = _("Are you sure that you want to delete this table?\nTable name: ") + table_name;
const Glib::ustring strMsg = Glib::ustring::compose(_("Are you sure that you want to delete this table?\nTable name: %1"), table_name);
Gtk::MessageDialog dialog(Utils::bold_message(_("Delete Table")), true);
dialog.set_secondary_text(strMsg);
dialog.set_transient_for(*Application::get_application());
int iButtonClicked = dialog.run();
const int iButtonClicked = dialog.run();
//Delete the table:
if(iButtonClicked == Gtk::RESPONSE_OK)
......
......@@ -148,7 +148,7 @@ void Utils::show_help(const Glib::ustring& id)
}
catch(const std::exception& ex)
{
const Glib::ustring message = _("Could not display help: ") + Glib::ustring(ex.what());
const Glib::ustring message = Glib::ustring::compose(_("Could not display help: %1"), Glib::ustring(ex.what()));
Gtk::MessageDialog dialog(message, false, Gtk::MESSAGE_ERROR);
dialog.run();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment