git-branch: remove lego in i18n messages
Instead of making translators translate "remote " and then using "%sbranch" where "%s" is either "remote " or "" just split the two up into separate messages. This makes the translation of this section of git-branch much less confusing. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Apr 30, 2012 at 15:33 UTC
c179837cfb43f5e354417c44c31410de5a74623b
1 file changed
+15
-9
builtin/branch.c
+15
-9
@@ -152,21 +152,22 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
152
struct commit *rev, *head_rev = NULL;
153
unsigned char sha1[20];
154
char *name = NULL;
155
- const char *fmt, *remote;
155
+ const char *fmt;
156
int i;
157
int ret = 0;
158
+ int remote_branch = 0;
159
struct strbuf bname = STRBUF_INIT;
160
161
switch (kinds) {
162
case REF_REMOTE_BRANCH:
163
fmt = "refs/remotes/%s";
163
- /* TRANSLATORS: This is "remote " in "remote branch '%s' not found" */
164
- remote = _("remote ");
164
+ /* For subsequent UI messages */
165
+ remote_branch = 1;
166
+
167
force = 1;
168
break;
169
case REF_LOCAL_BRANCH:
170
fmt = "refs/heads/%s";
169
- remote = "";
171
break;
172
default:
173
die(_("cannot use -a with -d"));
@@ -190,8 +191,9 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
191
192
name = xstrdup(mkpath(fmt, bname.buf));
193
if (read_ref(name, sha1)) {
193
- error(_("%sbranch '%s' not found."),
194
- remote, bname.buf);
194
+ error(remote_branch
195
+ ? _("remote branch '%s' not found.")
196
+ : _("branch '%s' not found."), bname.buf);
197
ret = 1;
198
continue;
199
}
@@ -212,14 +214,18 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
214
}
215
216
if (delete_ref(name, sha1, 0)) {
215
- error(_("Error deleting %sbranch '%s'"), remote,
217
+ error(remote_branch
218
+ ? _("Error deleting remote branch '%s'")
219
+ : _("Error deleting branch '%s'"),
220
bname.buf);
221
ret = 1;
222
} else {
223
struct strbuf buf = STRBUF_INIT;
224
if (!quiet)
221
- printf(_("Deleted %sbranch %s (was %s).\n"),
222
- remote, bname.buf,
225
+ printf(remote_branch
226
+ ? _("Deleted remote branch %s (was %s).\n")
227
+ : _("Deleted branch %s (was %s).\n"),
228
+ bname.buf,
229
find_unique_abbrev(sha1, DEFAULT_ABBREV));
230
strbuf_addf(&buf, "branch.%s", bname.buf);
231
if (git_config_rename_section(buf.buf, NULL) < 0)