tonsky / tongue

Do-it-yourself i18n library for Clojure/Script
Eclipse Public License 1.0
307 stars 19 forks source link

Suggestion: aliases #8

Closed cjohansen closed 3 years ago

cjohansen commented 6 years ago

I find it useful to use specific keys for most things in my UI, even when strings are the same. I do not, however, enjoy repeating the same strings all over. An example would be a "confirm button". I typically want this to be the same text most places, but I still want to use specific keys in specific views (:cart/confirm-button, :profile/save-button) so I can easily update texts without updating views.

To do this, I've implemented a transform for my dictionaries where values can be keywords, effectively making them aliases:

{:button/confirm "OK"
 :cart/confirm-button :button/confirm
 :profile/save-button :button/confirm}

Would you be interested in a pull request that made this a Tongue feature?

tonsky commented 6 years ago

Sounds like a good idea! Seems like it shouldn’t break anything. I’ll happily review a PR