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

Drop namespace support #14

Closed
StephanHoyer opened this issue Dec 18, 2015 · 6 comments
Closed

Drop namespace support #14

StephanHoyer opened this issue Dec 18, 2015 · 6 comments

Comments

@StephanHoyer
Copy link
Owner

@maranomynet I just thought if we can drop namespace support.

I do it the following way

// define translation
messages = {
  'foo.bar.baz': 'forbarbaz'
}

// usage
t('foo.bar.baz')

I think it can do all thing you can do with namespaces. It would simplify and for sure fasten the computation of the translation.

What do you think?

@StephanHoyer
Copy link
Owner Author

I find it also simpler in terms of maintenance since you can find unused translations more easily by matching the strings.

@StephanHoyer
Copy link
Owner Author

an other option would be to flatten the messages object during initialisation.

StephanHoyer added a commit that referenced this issue Dec 18, 2015
StephanHoyer added a commit that referenced this issue Dec 18, 2015
@StephanHoyer
Copy link
Owner Author

@maranomynet would you mind reviewing my pr and annotate or merge it.

@StephanHoyer
Copy link
Owner Author

this way you can also uglify your translation-keys with -d and -define-from-module option of uglify.js. Haven't tested though

@maranomynet
Copy link
Collaborator

I'm inclined to like this because it makes things faster and quite a bit simpler.

The main use-case I see for supporting namespaces, is that it makes composing large translation objects somewhat easier – but that minor benefit is hardly worth the added complexity. This is supposed to be a micro-library after all.

@maranomynet
Copy link
Collaborator

I might have been too hasty npm publishing 0.3.0 just now, but #16 won't have any functional impact on the code, so it can wait until the next release anyway.

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