Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translation file key has dots but is not a nested object #4

Closed
ryanseddon opened this issue May 20, 2014 · 3 comments
Closed

translation file key has dots but is not a nested object #4

ryanseddon opened this issue May 20, 2014 · 3 comments

Comments

@ryanseddon
Copy link
Contributor

I have a translation service that returns a flat object that is 1 level deep and all keys are namespaced using a dot as seperator for various reasons. Is there an option to tell counterpart to not split via dots?

{
  'namespace.subject' : 'A subject'
}

Would you be open to a PR adding this if it's not already possible?

@martinandert
Copy link
Owner

You are right, that's not already possible.

But I am always open to pull requests.

@martinandert
Copy link
Owner

Thanks for your pull request. After merging it I committed some "improvements":

  • rename splitKeyChar to separator (which is easier to grasp, I think)
  • added getSeparator and setSeparator function to change the default separator
  • added withSeparator function for convenience

A new minor version was released to npm.

I hope this works for you. Tell me if you still have issues with it.

@ryanseddon
Copy link
Contributor Author

splitKeyChar was a terrible name so happy for the changes. get/setSeparator is a really good idea and is perfect for our needs. Thanks for merging 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants