Closed katsuyasu-murata closed 5 years ago
I’m happy to accept this, but:
{xxx}
syntax. The idea of Tongue was that everything is formatted using same expression so you don’t have to remember anything elseApart from that code looks good and the idea is great as well. I think it will make a good addition. Thanks!
@tonsky Thank you for reviewing my PR!
I would prefer if it uses same {xxx} syntax. The idea of Tongue was that everything is formatted using same expression so you don’t have to remember anything else
-> I hope Tongue allow us to use %{xxx}
syntax, because we want to use same dictionaries as other programming servers without changes.
(For example, Rails and Clojure)
Map keys should be keywords, not strings. This is simply more idiomatic in Clojure
-> Thank you! I've fix it so that map's key use keyword.
same dictionaries as other programming servers
Can you point me at exact name of libraries that use that syntax?
Also: you want to share dictionaries between different systems? Or what is your use-case?
@tonsky
Can you point me at exact name of libraries that use that syntax?
The syntax is used in Ruby on Rails. We use the gem below url. https://github.com/svenfuchs/rails-i18n. Example↓
en:
activerecord:
errors:
messages:
record_invalid: 'Validation failed: %{errors}'
Also: you want to share dictionaries between different systems? Or what is your use-case?
I want to share dictionaries between different systems. We consider that a Clojure server receives message from a Rails server and the Clojure server send push notifications. In case of this, we want to share dictionaries in the same service. For example, we want to use a same sentence between a confirm message in the Rails server view and a push notification message in the Clojure server.
That’s a complete different syntax. Clojure uses EDN, while this is something indentation-based? That tells me that you’ll need to convert between dictionary formats anyway. So why not convert %{}
to {}
during the same step.
@tonsky Thank you for pointing out the %{} syntax. I gradually feel that it is not good to handle the %{} syntax in the tongue. I removed the %{} syntax handling, but I want to leave the map handling so it is useful.
Ok thanks, I’ll take a look later
Thanks! Pushed as 0.2.7
Issues
21 Add a substitution way for map
Fixes
%{xxx}
like other programming language's i18n process