Feature to skip the dot notation

#13 · closed · 2 comments

View on GitHub ↗

mfbx9da4

My keys are stored like so ``` { "account.email.title": "Email", "account.familyName.title": "Last name", "account.givenName.title": "First name", "account.pushNotifications": "Enable push notifications", "account.removeFromDevice.logout": "Logout", ``` Would love to use this lib but can't without an option to skip dot notation. Could that be on the horizon?

Comments

lukeed

You can use array notation, which is slightly more annoying, but it will leave each segment as is. Rosetta uses `dlv` directly for access, and so inherits its usage/conditions. ```js i18n.t(['account.email.title']); ``` Had a project like this in the past, and eventually everyone agreed to use `:` instead of `.` within the dictionary keys

mfbx9da4

thanks! can always implement a wrapper `translate = (key, data, locale) => i18n.t([key], data, locale)`