Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a localize template tag #273

Open
ellmetha opened this issue Oct 24, 2024 · 0 comments
Open

Add a localize template tag #273

ellmetha opened this issue Oct 24, 2024 · 0 comments
Assignees
Milestone

Comments

@ellmetha
Copy link
Member

Description

Let's introduce a new localize template tag allowing to perform basic localization operations in templates.

Context

Marten relies on crystal-i18n in order to power its internationalization features. The template engine presently provides a translate tag to perform translations within templates. That said, there is no easy way to perform localizations in templates at the moment (that is, without having to implement a custom template tag).

Proposition

Let's introduce a new localize tag template that will allow to perform the localizations that are already provided by crystal-i18n (that is, localizing dates, datetimes, and numbers).

Concretely, it should be possible to localize such values using the default format:

{% localize 100000 %}
{% localize created_at %}

We should also make it possible for users to explicitly define the localization format that they want to use with a dedicated format argument:

{% localize 100000 format: "custom" %}
{% localize created_at format: "short" %}
@ellmetha ellmetha added this to the v0.6.0 milestone Oct 24, 2024
@treagod treagod self-assigned this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants