Provide more examples of use for interpolation and date-time formatting options
See original GitHub issue- I am on the latest ember-intl version
- I have searched the issues of this repo and believe that this is not a duplicate
Environment
- Ember Version: 3.7.2
- Ember CLI Version: 3.7.1
- Ember Intl Version: 3.5.0
- Browser(s): Chrome
- Node Version: 10.12.0
When migrating from ember-i18n and ember-moment, I can’t find any examples nor docs explaining how to properly replace the following snippet:
{{
t "main.last.modified"
date=(moment-format
model.updatedAt "L HH:mm")
user=model.modifiedBy
}}
with ember-intl’s one.
The translation file has the following entry (I added date
and time
options later, they didn’t exist before):
main:
last.modified: 'Last modified on {date, date, time} by {user}'
Taking a look at ember-intl-example app which is a little bit outdated didn’t bring any solution.
Having the above in place, I replace the old code in the template with the new one:
{{t "main.last.modified" date=currentShop.shop.country.updatedAt user=currentShop.shop.country.modifiedBy }}
and the date is displayed correctly but without time.
What am I missing ? When should I use format-message
helper, when just t
, which options are available for date, times in templates and translation files ?
Thank you.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
string interpolation - format string output - Microsoft Learn
String interpolation provides a more readable, convenient syntax to format strings. It's easier to read than string composite formatting.
Read more >The Comprehensive Guide to Custom DateTime String ...
When working with C#, we can convert a DateTime object to a string. If we don't specify any formatting options, the default DateTime......
Read more >How to include a DateTime format as a constant inside string ...
I was upgrading code to use string interpolation, a feature introduced in C# 6, when I ran into a snag with DateTimes and...
Read more >Python String Interpolation - Programiz
This new way of formatting strings is powerful and easy to use. It provides access to embedded Python expressions inside string constants.
Read more >c# - Formatting dashes in string interpolation - Stack Overflow
The final version is more user friendly: var text = $"The time is {DateTime.Now:yyyy-MM-dd HH:mm:ss}";.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, thanks a lot! I’ll close the issue
You can remove it, it’s there as an example.