On #2148255: [meta] Make better D8 api.d.o landing page, linked to high-level overview topics, and put it in Core api.php files, we made a patch that included a stub Topic page for api.drupal.org (i.e., a @defgroup) titled:

Internationalization and translation

This can be found in file core/modules/system/core.api.php where it says

@defgroup i18n

The documentation to go on this page needs to be written. The idea is:

a) Write a few paragraphs about the topic.

b) Link to more detailed documentation on
https://drupal.org/developing/api/8

c) If the more detailed documentation does not yet exist, create stub page(s), link to the stub pages, and add a note to this issue stating that the stub pages need to be filled out.

d) If the topic has related classes, interfaces, and functions -- appropriate for an overview -- add

@ingroup i18n

to their documentation headers. That will make these classes etc. show up on the Topic page on api.drupal.org. Only include classes/functions that are appropriate for an overview page please!

For more info -- documentation standards for @defgroup/@ingroup:
https://drupal.org/coding-standards/docs#defgroup

Comments

jhodgdon’s picture

Issue tags: +beta target
jhodgdon’s picture

Assigned: Unassigned » jhodgdon

Time to write another one!

jhodgdon’s picture

Status: Active » Needs review
StatusFileSize
new8.16 KB

Here's a patch.

Note that it links to the info_types topic, which is defined in another issue that is waiting to be reviewed/committed. #2216559: Repurpose @defgroup/topic docs for Architecture Overview. The rest I think should be fairly self-explanatory. Hopefully also correct. :)

gábor hojtsy’s picture

Status: Needs review » Needs work
Issue tags: +D8MI, +sprint, +language-base

Looks generally good, thanks for working on this! Some comments:

  1. +++ b/core/modules/system/core.api.php
    @@ -456,12 +462,77 @@
    + * - Any time UI text is displayed using PHP code, it should be passed through
    + *   a translation method on the 'translation.manager' service class. (See the
    + *   @link container Services topic @endlink for information on how to
    + *   instantiate a service class.) Call these methods:
    + *   - \Drupal\Core\StringTranslation\TranslationInterface::translate()
    + *   - \Drupal\Core\StringTranslation\TranslationInterface::formatPlural()
    

    formatPlural() or t() global functions or methods are supported (not translate()!); most classes have a t() injected; for consistency, best to use the StringTranslationTrait: https://www.drupal.org/node/2079797

  2. +++ b/core/modules/system/core.api.php
    @@ -456,12 +462,77 @@
    + *   types label, text, and data_format are translatable; string is
    

    date_format

  3. +++ b/core/modules/system/core.api.php
    @@ -456,12 +462,77 @@
    + * - In JavaScript code, use the Drupal.t() function (defined in
    + *   core/misc/drupal.js) to translate UI text.
    

    Drupal.formatPlural() should also be mentioned.

plach’s picture

Looks good to me :)

jhodgdon’s picture

Status: Needs work » Needs review
StatusFileSize
new8.72 KB
new3.07 KB

Great, thanks for the reviews! I was sure there were some typos and that I'd probably gotten something not quite right. :)

Here's a fix for the issues in #4.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

  • Commit f413f88 on 8.x by webchick:
    Issue #2216541 by jhodgdon, Gábor Hojtsy: Fill in topic/@defgroup docs...

Status: Fixed » Needs work

The last submitted patch, 6: 2216541-i18n-topic-6.patch, failed testing.

jhodgdon’s picture

Status: Needs work » Fixed

Silly testbot! The patch has already been committed, no wonder it didn't apply!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

gábor hojtsy’s picture

Issue tags: -sprint