Add i18n support to api.drupal.org

Created on 20 December 2011, over 12 years ago
Updated 27 May 2024, about 1 month ago

For foreign developers who don't use English on a regular basis (e.g. Chinese developers), it's very hard for them to read English documentations. It will be extremely helpful, if we can add i18n support to api.drupal.org and documentation pages on d.o, so that people can start translating documentation when needed or interested. i18n support can also keep the translations in the same structure as their original pages.

I realize this request involves a big change, but I hope this issue can start the discussion.

✨ Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡³China skyredwang Shanghai

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    is it possible for me or anyone to request a sandbox of api.drupal.org?

    Yes, the new version of the "API" module comes with a full demo that you can install locally: https://git.drupalcode.org/project/api/-/tree/2.x/demo?ref_type=heads

    This matches 99% what's on api.drupal.org so you can play with it.

    My biggest worry, already mentioned above, is the maintenance of these translations. This is a huge endeavor, there are thousands and thousands of pages, blocks, etc and sometimes it's all a single block with comments and markup embedded.

    Markup is stored in the database like this (for this tiny snippet https://api.drupal.org/api/drupal/core%21modules%21action%21action.modul...):

    <pre class="php"><code><span class="php-keyword">function</span> <span class="php-function-or-constant"><a href="/api/drupal/core%21modules%21action%21action.module/function/action_entity_type_build/11.x" title="Implements hook_entity_type_build()." class="local">action_entity_type_build</a></span>(array &amp;<span class="php-variable">$entity_types</span>) {
        <span class="php-comment">
        /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */</span>
        <span class="php-variable">$entity_types</span>[<span class="php-string">'action'</span>]-&gt;<span class="php-function-or-constant"><a href="/api/drupal/11.x/search/setFormClass" title="Multiple implementations exist." class="local">setFormClass</a></span>(<span class="php-string">'add'</span>, ActionAddForm::class)
            -&gt;<span class="php-function-or-constant"><a href="/api/drupal/11.x/search/setFormClass" title="Multiple implementations exist." class="local">setFormClass</a></span>(<span class="php-string">'edit'</span>, ActionEditForm::class)
            -&gt;<span class="php-function-or-constant"><a href="/api/drupal/11.x/search/setFormClass" title="Multiple implementations exist." class="local">setFormClass</a></span>(<span class="php-string">'delete'</span>, <span class="php-string">'Drupal\\action\\Form\\ActionDeleteForm'</span>)
            -&gt;<span class="php-function-or-constant"><a href="/api/drupal/11.x/search/setListBuilderClass" title="Multiple implementations exist." class="local">setListBuilderClass</a></span>(<span class="php-string">'Drupal\\action\\ActionListBuilder'</span>)
            -&gt;<span class="php-function-or-constant"><a href="/api/drupal/11.x/search/setLinkTemplate" title="Multiple implementations exist." class="local">setLinkTemplate</a></span>(<span class="php-string">'delete-form'</span>, <span class="php-string">'/admin/config/system/actions/configure/{action}/delete'</span>)
            -&gt;<span class="php-function-or-constant"><a href="/api/drupal/11.x/search/setLinkTemplate" title="Multiple implementations exist." class="local">setLinkTemplate</a></span>(<span class="php-string">'edit-form'</span>, <span class="php-string">'/admin/config/system/actions/configure/{action}'</span>)
            -&gt;<span class="php-function-or-constant"><a href="/api/drupal/11.x/search/setLinkTemplate" title="Multiple implementations exist." class="local">setLinkTemplate</a></span>(<span class="php-string">'collection'</span>, <span class="php-string">'/admin/config/system/actions'</span>);
    }

  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    Then, on pages like this https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
    translating certain bits might be wrong, as you might be translating code, like "class" or "implements".

    For example, the content in the tables https://api.drupal.org/api/drupal/globals/11.x, or https://api.drupal.org/api/drupal/elements/11.x can't barely be translated.

  • Status changed to Closed: won't fix about 1 month ago
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    Per #10 and #11, closing this. The source code is rendered in the language that the code is written in.

Production build 0.69.0 2024