Skip to content

Feat/configurable fallback#150

Draft
jeppester wants to merge 1 commit into
adonisjs:3.xfrom
jeppester:feat/configurable-fallback
Draft

Feat/configurable fallback#150
jeppester wants to merge 1 commit into
adonisjs:3.xfrom
jeppester:feat/configurable-fallback

Conversation

@jeppester

Copy link
Copy Markdown
Contributor

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Makes it possible to extend I18nMessagesProvider and override how fall back messages are generated.
For instance it will be easy to use fallback provided by i18n, so that a "translation missing" message will be displayed.

This is a draft, made for collecting feedback, and not to be merged in just yet.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

This will make it easier to use the fallback provided by i18n itself.
@jeppester jeppester force-pushed the feat/configurable-fallback branch from 5727254 to 43248ff Compare June 2, 2026 07:58
@jeppester

jeppester commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Another way to solve this could be to just have the following as a default:

if (i18n.locale === 'en') {
    return string.interpolate(defaultMessage, {
      field: fieldName,
      ...meta,
    })
}
return i18n.t(ruleIdentifier, meta)

Less flexible, but probably what most people would want 🤔

@jeppester jeppester marked this pull request as draft June 2, 2026 08:05
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