Page MenuHomePhabricator

Fix wrong plural of an `arc land` message
ClosedPublic

Authored by jbeta on Aug 20 2015, 2:46 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 18, 7:22 AM
Unknown Object (File)
Thu, Apr 18, 7:22 AM
Unknown Object (File)
Thu, Apr 18, 7:22 AM
Unknown Object (File)
Thu, Apr 18, 7:16 AM
Unknown Object (File)
Thu, Apr 18, 7:09 AM
Unknown Object (File)
Thu, Apr 11, 12:02 PM
Unknown Object (File)
Thu, Apr 11, 8:07 AM
Unknown Object (File)
Tue, Apr 2, 3:56 PM
Subscribers

Details

Summary

"Branch" was pluralized as "branchs".

Fixes T9225.

Test Plan
  • Created test repo with two revisions on a feature branch.
  • Saw old message, frowned a little.
  • Applied patch.
  • No longer frowning.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jbeta retitled this revision from to Fix wrong plural of an `arc land` message.
jbeta updated this object.
jbeta edited the test plan for this revision. (Show Details)
jbeta added reviewers: epriestley, chad.

try something like

$branchTypePlural = magic ? 'bookmarks' : 'branches';
pht(
  'Separate these revisions onto different %s, or use.....',
  $branchTypePlural);

to avoid the lengthy text duplication.

Wouldn't that be harder to translate later on?

Overall, probably yes, but that's the way we do it everywhere (Like in line 501 on the left side here - $branchType is used as a value, and would need some magic to be translated anyway).
I think a fully translatable solution would require more affort - something like:

pht(
  'Separate these revisions onto different %s',
  pht_token(plural, $branchType));

And all the backend work for it.

Fair enough then, I'll update this.

All the existing code doing that kind of stuff in arc is wrong (and not translatable); this change is using the correct method.

This article got updated a while ago to include some examples like this:

https://secure.phabricator.com/book/phabcontrib/article/internationalization/

Hmm... still, @avivey should be right in that $this->branchType makes the complete message not translatable, no?

Oh, sweet. Didn't know this :)

Yeah. This is better than the old code was (this fragment is now properly translatable, and reads correctly in English), but the entire block of text should be present in each branch of the switch to be completely correct and fully translatable.

I'll mention two other very minor technical things for the sake of completeness:

First, this particular splitting of fragments requires translators to retain a newline at the end of the first translation, which may be hard if we eventually have non-technical translators or more human-friendly translation UIs. If a block of text should legitimately be split up, any paragraph formatting is probably better left untranslated. For example, it's probably better to do this:

$sections = array();
$sections[] = pht("First Section");
$sections[] = pht("Second Section");
$sections = implode("\n", $sections);

...than this:

$sections = array();
$sections[] = pht("First Section\n");
$sections[] = pht("Second Section");
$sections = implode('', $sections);

This gets rid of the need for translators to handle the "\n" properly, and is often a little easier for to work with code-wise too (e.g., you can reorder sections more easily). This will be made irrelevant by making the entire block translatable as a unit.

Second, indentation of the body of the switch() isn't consistent with the rest of the codebase, should be like this:

switch(...) {
  case ...:
}

...instead of:

switch(...) {
case ...:
}

(Indent stuff is a little tricky to handle statically, so automatic lint detection of indent rules lags behind other static checks.)

jbeta edited edge metadata.
  • Made the entire message block translatable
  • Fixed switch indentation

Got it. In general, the rest of the code relies on an untranslated $this->branchType. I suppose that should be solved in a more general diff.

epriestley edited edge metadata.

Yeah, it's fine to just fix this case without fixing every other case. This looks good to me, thanks!

This revision is now accepted and ready to land.Aug 20 2015, 11:18 AM
This revision was automatically updated to reflect the committed changes.