ktor icon indicating copy to clipboard operation
ktor copied to clipboard

Support to I18n messages

Open fbenevides opened this issue 5 years ago • 3 comments

Subsystem Ktor-features/ktor-i18n

Motivation Ktor doesn't have support to i18n messages by default, yet. So, this PR creates a new feature to support that.

Solution Using Accept-Language header provided on HTTP requests (as RFC 3282 explains), we can set a localized message bundle.

Features of this PR:

  • Creates a new feature called I18n - it could be installed by using:
install(I18n) {
  defaultLanguage = "pt-BR"
  encoding = StandardCharsets.UTF_8
}
  • Provides a way to set an defaultLanguage and encoding
  • Creates extensions in ApplicationCall to help translation on Ktor routes.
  • Reads resources/messages directory to manage message bundles

fbenevides avatar Feb 10 '20 14:02 fbenevides

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 10 '20 14:05 stale[bot]

It's a shame that this feature had been abandoned

awayo avatar Jul 21 '20 07:07 awayo

any idea on when we can review this PR?

fbenevides avatar Dec 29 '21 21:12 fbenevides

News on that? Anything I can help with?

fbenevides avatar Sep 27 '22 14:09 fbenevides

Hey @bjhham, I just rebased and updated the API. Could you take a fresh look?

e5l avatar Jan 03 '24 14:01 e5l