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

Return namespace in cimode with appendNamespaceToCIMode option #863

Merged
merged 1 commit into from Jan 21, 2017

Conversation

Projects
None yet
3 participants
@aray12
Contributor

aray12 commented Jan 19, 2017

No description provided.

@@ -56,17 +56,25 @@ class Translator extends EventEmitter {
if (typeof keys === 'number') keys = String(keys);
if (typeof keys === 'string') keys = [keys];
// return key on CIMode
let lng = options.lng || this.language;
if (lng && lng.toLowerCase() === 'cimode') return keys[keys.length - 1];

This comment has been minimized.

@aray12

aray12 Jan 19, 2017

Contributor

My tests for when appendNamespaceToCIMode: false failed initially before changes. This appears to be returning everything including the namespace if it is passed directly in the key (it is called before this.extractFromKey. I am not exactly sure why because this is the behavior I get in my application.

Below I started using key from this.exctractFromKey. Let me know if that was a bad idea.

@coveralls

This comment has been minimized.

coveralls commented Jan 19, 2017

Coverage Status

Coverage increased (+0.8%) to 66.437% when pulling a7b4380 on aray12:master into f888eb7 on i18next:master.

@jamuhl

This comment has been minimized.

Member

jamuhl commented Jan 19, 2017

Thanks for the PR...your change is ok...just need to think if i need to make this a breaking version - as we get different results now. For sure like this more as no random ns:key or key only depending on the calling code.

@aray12

This comment has been minimized.

Contributor

aray12 commented Jan 19, 2017

We use i18next and we make heavy use of namespaces to break files up. The weird thing is I don't get inconsistent behavior in our application even though we specify namespace in the key a lot.

e.g. in cimode

t('ns:key') => key

I looked at versions as well as file history and I have no idea why. Anyway I am glad you approve of this approach. Since the behavior is different I would recommend a major version bump in case anyone depends on existing behavior. (unfortunately)

@aray12

This comment has been minimized.

Contributor

aray12 commented Jan 19, 2017

I also created a PR for i18next.com here:

i18next/i18next.com#17

@jamuhl jamuhl merged commit 6aa81cd into i18next:master Jan 21, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.8%) to 66.437%
Details
@jamuhl

This comment has been minimized.

Member

jamuhl commented Jan 21, 2017

just published i18next@6.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment