# # patch "ChangeLog" # from [4634de721f789d3bbe2ab37b6c974cfd0eaf4dd3] # to [9b5549b782db62acc1e1da8e014f180bf1f85f33] # # patch "change_set.cc" # from [e13f7ab5ea191e09735f2e46b6710d6782b08b71] # to [abd8ef57e76e0663c16271f0b206de16ddd5628c] # # patch "commands.cc" # from [e5a84234e119daa9545a1714e10ce70f4536f24c] # to [b7c789a7ca488a85dea4d60819c6ab3550d0438d] # # patch "diff_patch.cc" # from [33ff3e3f0e333c53219315885fba81732282dd03] # to [18ce6168d9617190205a6c523653bde9e087fb42] # # patch "i18n.h" # from [a17416b64752616d0bcfafedb762e6b10b8f1bcf] # to [ee3bdf1adfed256d4148e41ee24880dfba11138b] # # patch "keys.cc" # from [c7d1fb792f418a999639b5675f6a7e4c57d748c8] # to [037dbc148e88db1b81ee5f7c3d0dcac7207423e8] # # patch "netsync.cc" # from [d73ec460c4c3fd85eb6c5098180185e470714227] # to [7722aed87080027bef960c2730859dc7cd5fa7e2] # # patch "sanity.cc" # from [ffb40b74ba38772ebf90bf7bc0f7ac710933a338] # to [6206133e98da6643d056aef8f051fc3ae0046eed] # # patch "ui.cc" # from [69b92313c143066d23c33bc4d8d38bf58c89949a] # to [09de41a28bae6dd080acc90b1bf8e9c32f9d7c01] # ======================================================================== --- ChangeLog 4634de721f789d3bbe2ab37b6c974cfd0eaf4dd3 +++ ChangeLog 9b5549b782db62acc1e1da8e014f180bf1f85f33 @@ -1,5 +1,25 @@ 2005-08-23 Benoît Dejean + * change_set.cc (dump_change_set): boost::format instead of F. + * commands.cc (get_log_message, notify_if_multiple_heads, + complete, CMD(attr)): Marked some strings for i18n. Replaced a + multiline string by prefix_lines_with(). Merged strings. + * diff_patch.cc (merge_provider::try_to_merge_files): Merged + strings. + * i18n.h: N_() stands for gettext_noop(), not plural. + * keys.cc (get_passphrase): Fixed string surgery. + * netsync.cc: i18nized tickers' labels. Added xgettext comment + as tickers do not play well with multibytes characters (like é). + (session::analyze_attachment): Fixed string surgery. + (session::process_hello_cmd): Merged many strings. + (session::process_data_cmd): Removed some leading/trailing + whitespaces. + * sanity.cc: Marked error prefixes for i18n. + * ui.cc (tick_write_count::write_ticks): Reworked and fixed + surgery. Merged some strings. + +2005-08-23 Benoît Dejean + * netcmd.cc (test_netcmd_functions): Don't translate unittest strings. * rcs_import.cc (cvs_commit::cvs_commit): ======================================================================== --- change_set.cc e13f7ab5ea191e09735f2e46b6710d6782b08b71 +++ change_set.cc abd8ef57e76e0663c16271f0b206de16ddd5628c @@ -3002,7 +3002,7 @@ split_into_lines(tmp(), lines); for (std::vector::const_iterator i = lines.begin(); i != lines.end(); ++i) - L(F("%s") % *i); + L(boost::format("%s") % *i); L(F("[end changeset %s]\n") % ctx); } ======================================================================== --- commands.cc e5a84234e119daa9545a1714e10ce70f4536f24c +++ commands.cc b7c789a7ca488a85dea4d60819c6ab3550d0438d @@ -354,10 +354,11 @@ write_revision_set(cs, summary); read_user_log(user_log_message); commentary += "----------------------------------------------------------------------\n"; - commentary += "Enter Log. Lines beginning with `MT:' are removed automatically\n"; + commentary += _("Enter Log. Lines beginning with `MT:' are removed automatically\n"); commentary += "\n"; commentary += summary(); commentary += "----------------------------------------------------------------------\n"; + N(app.lua.hook_edit_comment(commentary, user_log_message(), log_message), F("edit of log message failed")); } @@ -367,8 +368,12 @@ set heads; get_branch_heads(app.branch_name(), app, heads); if (heads.size() > 1) { - P(F("note: branch '%s' has multiple heads\nnote: perhaps consider 'monotone merge'") - % app.branch_name); + std::string prefixedline; + prefix_lines_with(_("note: "), + _("branch '%s' has multiple heads\n" + "perhaps consider 'monotone merge'"), + prefixedline); + P(boost::format(prefixedline) % app.branch_name); } } @@ -478,8 +483,9 @@ N(completions.size() == 1, boost::format(err)); } completion = *(completions.begin()); - P(F("expanding partial id '%s'\n") % str); - P(F("expanded to '%s'\n") % completion); + P(F("expanding partial id '%s'\n" + "expanded to '%s'\n") + % str % completion); } static void @@ -507,8 +513,9 @@ N(completions.size() == 1, boost::format(err)); } completion = *(completions.begin()); - P(F("expanding partial id '%s'\n") % str); - P(F("expanded to '%s'\n") % completion); + P(F("expanding partial id '%s'\n" + "expanded to '%s'\n") + % str % completion); } static void @@ -2129,7 +2136,7 @@ } file_path path = app.prefix(idx(args,1)()); - N(file_exists(path), F("file '%s' not found") % path); + N(file_exists(path), F("no such file %s") % path); bool attrs_modified = false; @@ -2735,7 +2742,7 @@ if (find_common_ancestor_for_merge(left, right, anc, app)) std::cout << describe_revision(app, anc) << std::endl; else - std::cout << "no common ancestor/dominator found" << std::endl; + std::cout << _("no common ancestor/dominator found") << std::endl; } ======================================================================== --- diff_patch.cc 33ff3e3f0e333c53219315885fba81732282dd03 +++ diff_patch.cc 18ce6168d9617190205a6c523653bde9e087fb42 @@ -586,11 +586,15 @@ } } - P(F("help required for 3-way merge\n")); - P(F("[ancestor] %s\n") % anc_path); - P(F("[ left] %s\n") % left_path); - P(F("[ right] %s\n") % right_path); - P(F("[ merged] %s\n") % merged_path); + P(F("help required for 3-way merge\n" + "[ancestor] %s\n" + "[ left] %s\n" + "[ right] %s\n" + "[ merged] %s\n") + % anc_path + % left_path + % right_path + % merged_path); if (app.lua.hook_merge3(anc_path, left_path, right_path, merged_path, ancestor_unpacked, left_unpacked, @@ -642,10 +646,13 @@ left_unpacked = left_data.inner(); right_unpacked = right_data.inner(); - P(F("help required for 2-way merge\n")); - P(F("[ left] %s\n") % left_path); - P(F("[ right] %s\n") % right_path); - P(F("[ merged] %s\n") % merged_path); + P(F("help required for 2-way merge\n" + "[ left] %s\n" + "[ right] %s\n" + "[ merged] %s\n") + % left_path + % right_path + % merged_path); if (app.lua.hook_merge2(left_path, right_path, merged_path, left_unpacked, right_unpacked, merged_unpacked)) ======================================================================== --- i18n.h a17416b64752616d0bcfafedb762e6b10b8f1bcf +++ i18n.h ee3bdf1adfed256d4148e41ee24880dfba11138b @@ -12,6 +12,6 @@ #include "gettext.h" #define _(str) gettext(str) -#define N_(str1, strn, n) ngettext(str1, strn, n) +#define N_(str) gettext_noop(str) #endif ======================================================================== --- keys.cc c7d1fb792f418a999639b5675f6a7e4c57d748c8 +++ keys.cc 037dbc148e88db1b81ee5f7c3d0dcac7207423e8 @@ -100,8 +100,8 @@ if (confirm_phrase) { ui.ensure_clean_line(); - read_password(string("confirm passphrase for key ID [") + keyid() + "]: ", - pass2, constants::maxpasswd); + read_password((F("confirm passphrase for key ID [%s]") % keyid()).str(), + pass2, constants::maxpasswd); cout << endl; if (strlen(pass1) == 0 || strlen(pass2) == 0) { ======================================================================== --- netsync.cc d73ec460c4c3fd85eb6c5098180185e470714227 +++ netsync.cc 7722aed87080027bef960c2730859dc7cd5fa7e2 @@ -657,25 +657,35 @@ void session::setup_client_tickers() { - byte_in_ticker.reset(new ticker("bytes in", ">", 1024, true)); - byte_out_ticker.reset(new ticker("bytes out", "<", 1024, true)); + // xgettext: please use short message and try to avoid multibytes chars + byte_in_ticker.reset(new ticker(_("bytes in"), ">", 1024, true)); + // xgettext: please use short message and try to avoid multibytes chars + byte_out_ticker.reset(new ticker(_("bytes out"), "<", 1024, true)); if (role == sink_role) { - revision_checked_ticker.reset(new ticker("revs written", "w", 1)); - cert_in_ticker.reset(new ticker("certs in", "c", 3)); - revision_in_ticker.reset(new ticker("revs in", "r", 1)); + // xgettext: please use short message and try to avoid multibytes chars + revision_checked_ticker.reset(new ticker(_("revs written"), "w", 1)); + // xgettext: please use short message and try to avoid multibytes chars + cert_in_ticker.reset(new ticker(_("certs in"), "c", 3)); + // xgettext: please use short message and try to avoid multibytes chars + revision_in_ticker.reset(new ticker(_("revs in"), "r", 1)); } else if (role == source_role) { - cert_out_ticker.reset(new ticker("certs out", "C", 3)); - revision_out_ticker.reset(new ticker("revs out", "R", 1)); + // xgettext: please use short message and try to avoid multibytes chars + cert_out_ticker.reset(new ticker(_("certs out"), "C", 3)); + // xgettext: please use short message and try to avoid multibytes chars + revision_out_ticker.reset(new ticker(_("revs out"), "R", 1)); } else { I(role == source_and_sink_role); - revision_checked_ticker.reset(new ticker("revs written", "w", 1)); - revision_in_ticker.reset(new ticker("revs in", "r", 1)); - revision_out_ticker.reset(new ticker("revs out", "R", 1)); + // xgettext: please use short message and try to avoid multibytes chars + revision_checked_ticker.reset(new ticker(_("revs written"), "w", 1)); + // xgettext: please use short message and try to avoid multibytes chars + revision_in_ticker.reset(new ticker(_("revs in"), "r", 1)); + // xgettext: please use short message and try to avoid multibytes chars + revision_out_ticker.reset(new ticker(_("revs out"), "R", 1)); } } @@ -919,7 +929,11 @@ } } } - L(F("decided that revision %s %s attached\n") % i % (curr_attached ? "is" : "is not")); + if (curr_attached) + L(F("decided that revision '%s' is attached\n") % i); + else + L(F("decided that revision '%s' is not attached\n") % i); + attached[i] = curr_attached; } @@ -1758,23 +1772,24 @@ app.db.get_var(their_key_key, expected_key_hash); if (expected_key_hash() != their_key_hash()) { - P(F("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n")); - P(F("@ WARNING: SERVER IDENTIFICATION HAS CHANGED @\n")); - P(F("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n")); - P(F("IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY\n")); - P(F("it is also possible that the server key has just been changed\n")); - P(F("remote host sent key %s\n") % their_key_hash); - P(F("I expected %s\n") % expected_key_hash); - P(F("'monotone unset %s %s' overrides this check\n") + P(F("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" + "@ WARNING: SERVER IDENTIFICATION HAS CHANGED @\n" + "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" + "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY\n" + "it is also possible that the server key has just been changed\n" + "remote host sent key %s\n" + "I expected %s\n" + "'monotone unset %s %s' overrides this check\n") + % their_key_hash % expected_key_hash % their_key_key.first % their_key_key.second); E(false, F("server key changed")); } } else { - P(F("first time connecting to server %s\n") % peer_id); - P(F("I'll assume it's really them, but you might want to double-check\n")); - P(F("their key's fingerprint: %s\n") % their_key_hash); + P(F("first time connecting to server %s\n" + "I'll assume it's really them, but you might want to double-check\n" + "their key's fingerprint: %s\n") % peer_id % their_key_hash); app.db.set_var(their_key_key, var_value(their_key_hash())); } if (!app.db.public_key_exists(their_key_hash)) @@ -2779,7 +2794,7 @@ // then the current netcmd packet cannot possibly have // written anything to the database. error((F("Mismatched epoch on branch %s." - " Server has '%s', client has '%s'.") + " Server has '%s', client has '%s'.") % branch % (voice == server_voice ? i->second : epoch) % (voice == server_voice ? epoch : i->second)).str()); @@ -2834,7 +2849,7 @@ L(F("revision '%s' already exists in our database\n") % hitem); else { - L(F("received revision '%s' \n") % hitem); + L(F("received revision '%s'\n") % hitem); boost::shared_ptr< pair > rp(new pair()); @@ -3669,9 +3684,12 @@ boost::shared_ptr ktab = make_root_node(*this, key_item); boost::shared_ptr etab = make_root_node(*this, epoch_item); - ticker revisions_ticker("revisions", "r", 64); - ticker certs_ticker("certs", "c", 256); - ticker keys_ticker("keys", "k", 1); + // xgettext: please use short message and try to avoid multibytes chars + ticker revisions_ticker(_("revisions"), "r", 64); + // xgettext: please use short message and try to avoid multibytes chars + ticker certs_ticker(_("certs"), "c", 256); + // xgettext: please use short message and try to avoid multibytes chars + ticker keys_ticker(_("keys"), "k", 1); set revision_ids; set inserted_keys; ======================================================================== --- sanity.cc ffb40b74ba38772ebf90bf7bc0f7ac710933a338 +++ sanity.cc 6206133e98da6643d056aef8f051fc3ae0046eed @@ -194,7 +194,7 @@ string message; log(format("%s:%d: usage constraint '%s' violated\n") % file % line % expr, file.c_str(), line); - prefix_lines_with("misuse: ", explain.str(), message); + prefix_lines_with(_("misuse: "), explain.str(), message); throw informative_failure(message); } @@ -205,7 +205,7 @@ string message; log(format("%s:%d: detected error '%s' violated\n") % file % line % expr, file.c_str(), line); - prefix_lines_with("error: ", explain.str(), message); + prefix_lines_with(_("error: "), explain.str(), message); throw informative_failure(message); } ======================================================================== --- ui.cc 69b92313c143066d23c33bc4d8d38bf58c89949a +++ ui.cc 09de41a28bae6dd080acc90b1bf8e9c32f9d7c01 @@ -111,22 +111,25 @@ if (i->second->kilocount && i->second->ticks >= 10000) { // automatic unit conversion is enabled float div; - string suffix; + const char *message; if (i->second->ticks >= 1048576) { // ticks >=1MB, use Mb div = 1048576; - suffix = "M"; + // xgettext: mebibytes (2^20 bytes) + message = N_("%.1f M"); } else { // ticks <1MB, use kb div = 1024; - suffix = "k"; + // xgettext: kibibytes (2^10 bytes) + message = N_("%.1f k"); } // we reset the mod to the divider, to avoid spurious screen updates i->second->mod = static_cast(div / 10.0); - count = (F("%.1f%s") % (i->second->ticks / div) % suffix).str(); + count = (F(message) % (i->second->ticks / div)).str(); } else { + // xgettext: bytes count = (F("%d") % i->second->ticks).str(); } @@ -310,10 +313,11 @@ void user_interface::fatal(string const & fatal) { - inform("fatal: " + fatal); - inform("this is almost certainly a bug in monotone.\n"); - inform("please send this error message, the output of 'monotone --full-version',\n"); - inform("and a description of what you were doing to " PACKAGE_BUGREPORT ".\n"); + inform(F("fatal: %s\n" + "this is almost certainly a bug in monotone.\n" + "please send this error message, the output of 'monotone --full-version',\n" + "and a description of what you were doing to %s.\n") + % fatal % PACKAGE_BUGREPORT); } @@ -352,7 +356,7 @@ user_interface::inform(string const & line) { string prefixedLine; - prefix_lines_with("monotone: ", line, prefixedLine); + prefix_lines_with(_("monotone: "), line, prefixedLine); ensure_clean_line(); clog << sanitize(prefixedLine) << endl; clog.flush();