• Peter Serwylo's avatar
    I18n titles of documents if they are "." separated strings. · 1c2c79de
    Peter Serwylo authored
    For example, if the frontmatter of a document is:
    
    ```
    ---
    title: "This is a title"
    ---
    ```
    
    Then it will render as "This is a title" as expected. However, if it is:
    
    ```
    ---
    title: strings.page_one.heading
    ---
    ```
    
    Then it will look for the file in `_data/strings.json` for the following
    entry:
    
    ```
    {
      "page_one": {
        "heading": "This is a heading",
        ...
      },
      ...
    }
    ```
    
    and the resulting heading will be "This is a heading". If the resulting
    JSON entry cannot be found, it is presumed that it is not actually
    trying to i18n the title and will instead use whatever it found in the
    frontmatter (e.g. "not.json" will result in a title of "not.json").
    
    The rationale for this is that the polyglot plugin doesn't support i189n
    titles, because they rightly point out that you can [do this kind of
    string lookup quite trivially in a liquid
    template](https://github.com/untra/polyglot/issues/34#issuecomment-252774718).
    However, that doesn't take into account the fact that page titles appear
    elsewhere, such as in pagination pages. This would require the same
    logic to appear everywhere a document title could be rendered.
    
    Additionally, we already have a process for translating
    post/documentation page titles, where the title is translated in weblate
    right next to the document content. It would be annoying to say the
    least if people translated documents in the "Docs" weblate project (a
    .po based project), but then had to go to a different (JSON based)
    project in order to translate the titles.
    1c2c79de
Name
Last commit
Last update
..
add-repo.html Loading commit data...
create-repo.html Loading commit data...
swap.html Loading commit data...