Dokumentationsmeny

Translating articles

Beta. Localhero.ai can translate whole Markdown articles next to your locale files: help center articles, product docs, guides and similar text that lives in your repo. You write or change the English article in a pull request. The translations are committed to the same pull request, the same way new strings are.

An article is translated with your project's glossary, style guide and tone of voice. When it names something in your app, such as a button or a menu, it uses the wording your app already has in that language.

Articles are turned on per project by us while this is in beta. The last section on this page says how to get started.

When it fits

  • Your articles are Markdown files in a Git repository.
  • Each language has its own folder, such as articles/en/ and articles/sv/.
  • You want articles to follow the same glossary and wording as the app they describe.

It works in the same repository as your app or in a separate one for your help center. A project can hold both locale files and articles.

Works great with for example:

  • Help centers. Support articles that tell the reader what to click in your app.
  • Product documentation. Guides, how-tos and reference pages.
  • Changelogs and release notes.
  • Blog posts. Check the length limit below. The file name stays the same in every language, so the URL usually does too.

Turn it on

Articles are opt-in. Add md to translationFiles.pattern and make sure the folder with your articles is under translationFiles.paths.

localhero.json (excerpt)

"translationFiles": {
  "paths": ["config/locales/", "articles/"],
  "pattern": "**/*.{yml,yaml,md}"
}

A project whose pattern doesn't name md works exactly as before. You need version 0.0.93 or later of the CLI. The GitHub Action uses the latest version unless you pin cli-version.

Folder layout

The language of an article is the one folder in its path that is a locale of your project. The translation is written to the same path with that folder swapped:

articles/en/getting-started.md      source
articles/sv/getting-started.md      Swedish
articles/de/getting-started.md      German

The file name is the same in every language. A locale in the file name, such as getting-started.sv.md, is not supported yet. Neither is a layout where the English articles have no locale folder of their own.

What gets translated

Part What happens
Text Headings, paragraphs, lists and tables are translated.
Front matter Only the values of title, subtitle, description, metaDescription, summary and excerpt are translated. Every other line stays as it is, keys included.
Code blocks Left exactly as in the English article.
Links and images The link text and alt text are translated. The targets and image paths stay the same.
Placeholders Placeholders like {{name}} are kept.

Your app's wording in articles

A help article often tells the reader what to click. If the English article says Save draft and your Swedish app says Spara utkast, the Swedish article should say Spara utkast too.

When an article names a part of your app, Localhero.ai looks up how your locale files translate it and uses that wording. It looks in the project the article belongs to. It can also look in your organization's other projects, which helps when the help center sits in its own repository. Tell us which projects it should use when we turn articles on.

Glossary terms work as they do for strings. A term the glossary says to keep or to translate a certain way is flagged for the reviewer when the article doesn't follow it.

When the English changes

A new article is translated in full.

When you change an article that is already on your base branch, its translations are updated paragraph by paragraph. Only the paragraphs whose English changed are translated again. The rest of the translated article stays as it was.

Paragraphs a reviewer has edited are treated with more care. When the English under such a paragraph changes in a simple way, for example one paragraph replaced by a new version, the paragraph is translated again with the reviewer's wording as the wording to keep. When the change is harder to follow, such as paragraphs moved or merged, Localhero.ai leaves the reviewer's text alone and marks it as needing an update on the pull request's page. A person updates it there.

Some changes are too large to update paragraph by paragraph. The page then says the language wasn't updated and why.

Checks

Every translated article is compared with the English one before it is committed:

  • Front matter has the same lines, with only the translated values changed.
  • Code blocks are identical.
  • Link targets and image paths are the same.
  • Headings and list items match in number and level.
  • Placeholders and numbers match.
  • The translation is not cut short.

A translation that fails a check is tried once more. If it still fails, the reviewer gets a warning on the article that says what differs.

Review

Articles show up on the pull request's page on Localhero.ai with the rest of the translations. A reviewer can read the translated article next to the English one, edit it and see its history. Edits go back to the pull request as a commit. See Review workflow for how review and approval work.

Limits

  • Markdown only (.md and .markdown). MDX and HTML files are skipped with a warning.
  • An article can be up to 20,000 characters. Longer articles and empty files are skipped with a warning.
  • The locale has to be a folder in the path, as described above.
  • translate and ci handle articles. check, push and pull don't read them yet.
  • This is a beta. Details may change.

Credits

Articles use credits like other translations. An article is counted on its text. HTML tags are left out. So are the targets of inline links and images, such as the URL in [Settings](/settings). When an article is updated, only the changed paragraphs are counted.

Want to use it?

Articles are in beta and we turn them on per project. Email hi@localhero.ai with roughly how many articles you have, which languages you need and where the files live. We'll help you get set up.

Last updated

Redo att testa?

Kom igång på några minuter. Inget kreditkort behövs.