I'm using Rails i18n to localize my website.
In the translation yml file, I see
time:
am: am
formats:
default: ! '%a, %d %b %Y %H:%M:%S %z'
long: ! '%d %B, %Y %H:%M'
short: ! '%d %b %H:%M'
pm: pm
(taken from https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en-GB.yml)
What does the exclamation mark mean? How is it different if you take away the exclamation mark?
Thanks
I'm not an expert, but I see from the YAML spec that you can use an exclamation mark to indicate a custom object/type, and two exclamation marks to indicate an explicit built-in type.
The Ruby I18n (shorthand for internationalization) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for translating your application to a single custom language other than English or for providing multi-language support in your application.
% is a special character in YAML. Single exclamation mark avoids it to be parsed as a special character and passes it as a String.
Copying the answer from the comments in order to remove this question from the "Unanswered" filter:
See What does a single exclamation mark do in YAML?
~ link per Stefan, linked question answered by Juan Mellado
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With