Page MenuHomePhabricator

Format Calendar list objects
ClosedPublic

Authored by lpriestley on Jun 16 2015, 10:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 17, 2:38 AM
Unknown Object (File)
Mon, Dec 9, 11:28 AM
Unknown Object (File)
Thu, Dec 5, 8:05 AM
Unknown Object (File)
Thu, Dec 5, 4:40 AM
Unknown Object (File)
Thu, Nov 28, 12:13 AM
Unknown Object (File)
Nov 20 2024, 12:46 AM
Unknown Object (File)
Nov 15 2024, 7:49 PM
Unknown Object (File)
Nov 14 2024, 5:05 AM
Subscribers

Details

Reviewers
epriestley
chad
Group Reviewers
Blessed Reviewers
Maniphest Tasks
T8050: Calendar List formatting
Commits
Restricted Diffusion Commit
rPe291b906419a: Format Calendar list objects
Summary

Closes T8050, Format Calendar list objects

Test Plan

Open Calendar list, check that new formatting is true to mocks.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lpriestley retitled this revision from to Format Calendar list objects.
lpriestley updated this object.
lpriestley edited the test plan for this revision. (Show Details)
lpriestley added reviewers: epriestley, chad.
epriestley edited edge metadata.
epriestley added inline comments.
src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
339–340

These may layout better, especially on mobile, as addIcon('none', $value) instead of addByline(...).

src/applications/calendar/storage/PhabricatorCalendarEvent.php
376

This method is mostly not translatable, because it hard-codes English plural rules.

In English, there are forms for "one" (like 'day') and "any number other than one" (like 'days').

Languages like Czech have different plural forms for "one", "several" and "many". For example, in Czech, you say "1 den", then "2 dny", "3 dny", "4 dny", but then "5 dnů", "6 dnů", etc (or so says Google Translate). It isn't possible to translate a string like "days" into Czech, because the translator needs to know if there are 3 or 5 of them to hcoose between "dny" and "dnů".

It may also be difficult or impossible to translate fragments of sentences correctly. In some languages, in "1 day, 3 hours", the correct word for "day" might depend on how many hours there are. A more general (although less similar) example of this is Spanish, where articles depend on nouns.

If we asked a Spanish-speaking user to translate the fragment "I am the" and then separately translate "pen." and "pencil.", they would not be able to produce a correct translation which would satisfy a native speaker, because the word for "the" depends on the noun: the first fragment might be "Yo soy la" or "Yo so el" depending on the rest of the sentence.

(In other languages, the most natural way to translate this sentence might read more like "The pen, it is me." if transliterated, but a translator can't reorder the words properly to produce this most-satisfying-translation if they're handed fragments.)

Broadly, this means translatable strings should let the translation engine handle plural rules and should usually be complete sentences, or at least as complete as possible.

Here, I'd expect there to be 5 pht() calls total, for these strings:

  • "%s day(s)"
  • "%s day(s), %s hour(s)" (it is probably not useful to show minutes if an event is more than a day long)
  • "%s hour(s)"
  • "%s hour(s), %s minute(s)"
  • "%s minute(s)"

You can then edit the PhabricatorUSEnglishTranslation to translate %s day(s) into "1 day" and "2 days", but using the strings as the basis for the translation allows a future Czech translator to specify all the variants their language needs.

You could also use phutil_format_relative_time() to produce an uglier, also-untranslatable version of this string, but we'll have to go fix that method eventually anyway.

This revision now requires changes to proceed.Jun 18 2015, 12:54 PM
lpriestley edited edge metadata.

making duration string more translateable and fit for width

epriestley edited edge metadata.
This revision is now accepted and ready to land.Jun 18 2015, 5:44 PM
This revision was automatically updated to reflect the committed changes.