Skip to content

Conversation

bartholomej
Copy link

Feature Description

I've implemented a new enhancement for the missingTranslationString option that allows using a {{t}} placeholder variable to include the translation key itself in the default text.

How it works

When a missing translation is added to language files, you can now use the {{t}} placeholder in the missingTranslationString value to have it replaced with the actual translation key. For example:

  • Using --missingTranslationString='Translation missing: {{t}}' would create entries like:
  • For key user.greeting: "user.greeting": "Translation missing: user.greeting"
  • For key errors.notFound: "errors.notFound": "Translation missing: errors.notFound"

Benefits

  1. Provides more contextual default translations
  2. Helps developers identify which key needs translation
  3. Makes the system more flexible for different use cases
  4. Can be used in combination with other text to create meaningful fallback messages

Documentation

I've updated the documentation to include this new functionality in the missingTranslationString section with examples of how to use it.

@@ -16,7 +16,7 @@
"source": "src/index.ts",
"bin": "bin/vue-i18n-extract.js",
"main": "dist/vue-i18n-extract.umd.js",
"module": "dist/vue-i18n-extract.modern.js",
"module": "dist/vue-i18n-extract.modern.mjs",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected the module field in package.json from .js to .mjs to match the actual file in the dist folder. The original extension was probably a typo as no .js file exists in dist, only .mjs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant