Skip to content

auto scan for translation strings #58

Closed
@JohnRDOrazio

Description

@JohnRDOrazio

Rather than manually adding translation strings to the public/locales/en/translation.json file, and trying to keep other language files in sync with the English language file, a simple scanner could be implemented and triggered either when committing/pushing or when a PR is issued.

For example, https://github.com/i18next/i18next-scanner .

I've run a few tests locally, but I'm running into a couple issues which I haven't succeeded in overcoming yet:

  1. The tags within <Trans> components (such as <p>, <b>, <i>, <strong>, etc.) are being substituted with indexed tags, even though I set supportBasicHtmlNodes to true and keepBasicHtmlNodesFor to ['br', 'strong', 'i', 'p', 'b', 'vatican', 'github']. I have tried a few things such as:

    • setting similar options in i18n initialization ( transSupportBasicHtmlNodes and transKeepBasicHtmlNodesFor ) to no avail
    • setting the components parameter within the Trans component to no avail

    i18next-scanner is supposed to be able to play nicely with Trans components, but I haven't been having much luck as of yet

  2. While the configuration option defaultValue works fine for t() functions, however for Trans components the string value in English is being set in all language files, whether English or not. Instead it would be desirable for an empty value to be set in non English language files, while the source string is correctly set in the English language file. This perhaps needs to be handled within the customTransform function?

I have created a new branch to track progress on this: feature/i18n-scanner

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions