Fix missing translations, enable dutch language (#878)

* Fix missing translations, enable dutch language
This commit is contained in:
Pranav Raj S 2020-05-19 19:05:10 +05:30 committed by GitHub
parent 3f5ce2ddbf
commit 8af200ad20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 216 additions and 107 deletions

View file

@ -18,56 +18,56 @@ GEM
specs: specs:
action-cable-testing (0.6.1) action-cable-testing (0.6.1)
actioncable (>= 5.0) actioncable (>= 5.0)
actioncable (6.0.3) actioncable (6.0.3.1)
actionpack (= 6.0.3) actionpack (= 6.0.3.1)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.0.3) actionmailbox (6.0.3.1)
actionpack (= 6.0.3) actionpack (= 6.0.3.1)
activejob (= 6.0.3) activejob (= 6.0.3.1)
activerecord (= 6.0.3) activerecord (= 6.0.3.1)
activestorage (= 6.0.3) activestorage (= 6.0.3.1)
activesupport (= 6.0.3) activesupport (= 6.0.3.1)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.0.3) actionmailer (6.0.3.1)
actionpack (= 6.0.3) actionpack (= 6.0.3.1)
actionview (= 6.0.3) actionview (= 6.0.3.1)
activejob (= 6.0.3) activejob (= 6.0.3.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.0.3) actionpack (6.0.3.1)
actionview (= 6.0.3) actionview (= 6.0.3.1)
activesupport (= 6.0.3) activesupport (= 6.0.3.1)
rack (~> 2.0, >= 2.0.8) rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3) actiontext (6.0.3.1)
actionpack (= 6.0.3) actionpack (= 6.0.3.1)
activerecord (= 6.0.3) activerecord (= 6.0.3.1)
activestorage (= 6.0.3) activestorage (= 6.0.3.1)
activesupport (= 6.0.3) activesupport (= 6.0.3.1)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.0.3) actionview (6.0.3.1)
activesupport (= 6.0.3) activesupport (= 6.0.3.1)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.3) activejob (6.0.3.1)
activesupport (= 6.0.3) activesupport (= 6.0.3.1)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.0.3) activemodel (6.0.3.1)
activesupport (= 6.0.3) activesupport (= 6.0.3.1)
activerecord (6.0.3) activerecord (6.0.3.1)
activemodel (= 6.0.3) activemodel (= 6.0.3.1)
activesupport (= 6.0.3) activesupport (= 6.0.3.1)
activestorage (6.0.3) activestorage (6.0.3.1)
actionpack (= 6.0.3) actionpack (= 6.0.3.1)
activejob (= 6.0.3) activejob (= 6.0.3.1)
activerecord (= 6.0.3) activerecord (= 6.0.3.1)
marcel (~> 0.3.1) marcel (~> 0.3.1)
activesupport (6.0.3) activesupport (6.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
@ -96,8 +96,8 @@ GEM
autoprefixer-rails (9.7.6) autoprefixer-rails (9.7.6)
execjs execjs
aws-eventstream (1.1.0) aws-eventstream (1.1.0)
aws-partitions (1.315.0) aws-partitions (1.317.0)
aws-sdk-core (3.95.0) aws-sdk-core (3.96.1)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0) aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
@ -105,8 +105,8 @@ GEM
aws-sdk-kms (1.31.0) aws-sdk-kms (1.31.0)
aws-sdk-core (~> 3, >= 3.71.0) aws-sdk-core (~> 3, >= 3.71.0)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.64.0) aws-sdk-s3 (1.65.0)
aws-sdk-core (~> 3, >= 3.83.0) aws-sdk-core (~> 3, >= 3.96.1)
aws-sdk-kms (~> 1) aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
aws-sigv4 (1.1.3) aws-sigv4 (1.1.3)
@ -194,7 +194,7 @@ GEM
foreman (0.87.1) foreman (0.87.1)
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
google-api-client (0.39.3) google-api-client (0.39.4)
addressable (~> 2.5, >= 2.5.1) addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.9) googleauth (~> 0.9)
httpclient (>= 2.8.1, < 3.0) httpclient (>= 2.8.1, < 3.0)
@ -288,7 +288,7 @@ GEM
mini_magick (4.10.1) mini_magick (4.10.1)
mini_mime (1.0.2) mini_mime (1.0.2)
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
minitest (5.14.0) minitest (5.14.1)
momentjs-rails (2.20.1) momentjs-rails (2.20.1)
railties (>= 3.1) railties (>= 3.1)
msgpack (1.3.3) msgpack (1.3.3)
@ -312,7 +312,7 @@ GEM
pry-rails (0.3.9) pry-rails (0.3.9)
pry (>= 0.10.4) pry (>= 0.10.4)
public_suffix (4.0.5) public_suffix (4.0.5)
puma (4.3.3) puma (4.3.4)
nio4r (~> 2.0) nio4r (~> 2.0)
pundit (2.1.0) pundit (2.1.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@ -327,29 +327,29 @@ GEM
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (6.0.3) rails (6.0.3.1)
actioncable (= 6.0.3) actioncable (= 6.0.3.1)
actionmailbox (= 6.0.3) actionmailbox (= 6.0.3.1)
actionmailer (= 6.0.3) actionmailer (= 6.0.3.1)
actionpack (= 6.0.3) actionpack (= 6.0.3.1)
actiontext (= 6.0.3) actiontext (= 6.0.3.1)
actionview (= 6.0.3) actionview (= 6.0.3.1)
activejob (= 6.0.3) activejob (= 6.0.3.1)
activemodel (= 6.0.3) activemodel (= 6.0.3.1)
activerecord (= 6.0.3) activerecord (= 6.0.3.1)
activestorage (= 6.0.3) activestorage (= 6.0.3.1)
activesupport (= 6.0.3) activesupport (= 6.0.3.1)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 6.0.3) railties (= 6.0.3.1)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0) rails-html-sanitizer (1.3.0)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.0.3) railties (6.0.3.1)
actionpack (= 6.0.3) actionpack (= 6.0.3.1)
activesupport (= 6.0.3) activesupport (= 6.0.3.1)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0) thor (>= 0.20.3, < 2.0)
@ -388,7 +388,7 @@ GEM
rspec-mocks (3.9.1) rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0) rspec-support (~> 3.9.0)
rspec-rails (4.0.0) rspec-rails (4.0.1)
actionpack (>= 4.2) actionpack (>= 4.2)
activesupport (>= 4.2) activesupport (>= 4.2)
railties (>= 4.2) railties (>= 4.2)

View file

@ -1,12 +1,13 @@
import ca from './locale/ca'; import ca from './locale/ca';
import ro from './locale/ro';
import fr from './locale/fr';
import pt_BR from './locale/pt_BR';
import de from './locale/de'; import de from './locale/de';
import el from './locale/el'; import el from './locale/el';
import en from './locale/en'; import en from './locale/en';
import fr from './locale/fr';
import nl from './locale/nl';
import ml from './locale/ml'; import ml from './locale/ml';
import pt from './locale/pt'; import pt from './locale/pt';
import pt_BR from './locale/pt_BR';
import ro from './locale/ro';
export default { export default {
ca, ca,
@ -14,6 +15,7 @@ export default {
el, el,
en, en,
fr, fr,
nl,
ml, ml,
pt_BR, pt_BR,
pt, pt,

View file

@ -0,0 +1,34 @@
/* eslint-disable */
import { default as _agentMgmt } from './agentMgmt.json';
import { default as _billing } from './billing.json';
import { default as _cannedMgmt } from './cannedMgmt.json';
import { default as _chatlist } from './chatlist.json';
import { default as _contact } from './contact.json';
import { default as _conversation } from './conversation.json';
import { default as _inboxMgmt } from './inboxMgmt.json';
import { default as _login } from './login.json';
import { default as _report } from './report.json';
import { default as _resetPassword } from './resetPassword.json';
import { default as _setNewPassword } from './setNewPassword.json';
import { default as _settings } from './settings.json';
import { default as _signup } from './signup.json';
import { default as _integrations } from './integrations.json';
import { default as _generalSettings } from './generalSettings.json';
export default {
..._agentMgmt,
..._billing,
..._cannedMgmt,
..._chatlist,
..._contact,
..._conversation,
..._inboxMgmt,
..._login,
..._report,
..._resetPassword,
..._setNewPassword,
..._settings,
..._signup,
..._integrations,
..._generalSettings,
};

View file

@ -13,11 +13,12 @@
<script> <script>
import GroupedAvatars from 'widget/components/GroupedAvatars.vue'; import GroupedAvatars from 'widget/components/GroupedAvatars.vue';
import { getAvailableAgentsText } from 'widget/helpers/utils'; import agentMixin from '../mixins/agentMixin';
export default { export default {
name: 'AvailableAgents', name: 'AvailableAgents',
components: { GroupedAvatars }, components: { GroupedAvatars },
mixins: [agentMixin],
props: { props: {
agents: { agents: {
type: Array, type: Array,
@ -37,7 +38,7 @@ export default {
})); }));
}, },
title() { title() {
return getAvailableAgentsText(this.agents); return this.getAvailableAgentsText(this.agents);
}, },
}, },
}; };

View file

@ -1,26 +0,0 @@
import { getAvailableAgentsText } from '../utils';
describe('#getAvailableAgentsText', () => {
it('returns the correct text is there is only one online agent', () => {
expect(getAvailableAgentsText([{ name: 'Pranav' }])).toEqual(
'Pranav is available'
);
});
it('returns the correct text is there are two online agents', () => {
expect(
getAvailableAgentsText([{ name: 'Pranav' }, { name: 'Nithin' }])
).toEqual('Pranav and Nithin are available');
});
it('returns the correct text is there are more than two online agents', () => {
expect(
getAvailableAgentsText([
{ name: 'Pranav' },
{ name: 'Nithin' },
{ name: 'Subin' },
{ name: 'Sojan' },
])
).toEqual('Pranav and 3 others are available');
});
});

View file

@ -17,20 +17,3 @@ export const IFrameHelper = {
); );
}, },
}; };
export const getAvailableAgentsText = (agents = []) => {
const count = agents.length;
if (count === 1) {
const [agent] = agents;
return `${agent.name} is available`;
}
if (count === 2) {
const [first, second] = agents;
return `${first.name} and ${second.name} are available`;
}
const [agent] = agents;
const rest = agents.length - 1;
return `${agent.name} and ${rest} others are available`;
};

View file

@ -8,6 +8,12 @@
"SUBMIT": "إرسال" "SUBMIT": "إرسال"
} }
}, },
"AGENT_AVAILABILITY": {
"IS_AVAILABLE": "is available",
"ARE_AVAILABLE": "are available",
"OTHERS_ARE_AVAILABLE": "others are available",
"AND": "and"
},
"POWERED_BY": "مدعوم بواسطة Chatwoot", "POWERED_BY": "مدعوم بواسطة Chatwoot",
"EMAIL_PLACEHOLDER": "الرجاء إدخال بريدك الإلكتروني", "EMAIL_PLACEHOLDER": "الرجاء إدخال بريدك الإلكتروني",
"CHAT_PLACEHOLDER": "أكتب رسالتك" "CHAT_PLACEHOLDER": "أكتب رسالتك"

View file

@ -8,6 +8,12 @@
"SUBMIT": "sotmetre's" "SUBMIT": "sotmetre's"
} }
}, },
"AGENT_AVAILABILITY": {
"IS_AVAILABLE": "està disponible",
"ARE_AVAILABLE": "estan disponibles",
"OTHERS_ARE_AVAILABLE": "altres estan disponibles",
"AND": "i"
},
"POWERED_BY": "Desenvolupat per Chatwoot", "POWERED_BY": "Desenvolupat per Chatwoot",
"EMAIL_PLACEHOLDER": "Introduïu el vostre correu electrònic", "EMAIL_PLACEHOLDER": "Introduïu el vostre correu electrònic",
"CHAT_PLACEHOLDER": "Escriu el teu missatge" "CHAT_PLACEHOLDER": "Escriu el teu missatge"

View file

@ -8,6 +8,12 @@
"SUBMIT": "Submit" "SUBMIT": "Submit"
} }
}, },
"AGENT_AVAILABILITY": {
"IS_AVAILABLE": "ist verfügbar",
"ARE_AVAILABLE": "sind verfügbar",
"OTHERS_ARE_AVAILABLE": "andere sind verfügbar",
"AND": "und"
},
"POWERED_BY": "Unterstützt von Chatwoot", "POWERED_BY": "Unterstützt von Chatwoot",
"EMAIL_PLACEHOLDER": "Bitte geben Sie ihre E-Mail-Adresse ein", "EMAIL_PLACEHOLDER": "Bitte geben Sie ihre E-Mail-Adresse ein",
"CHAT_PLACEHOLDER": "Geben Sie Ihre Nachricht ein" "CHAT_PLACEHOLDER": "Geben Sie Ihre Nachricht ein"

View file

@ -8,6 +8,12 @@
"SUBMIT": "Καταχώρηση" "SUBMIT": "Καταχώρηση"
} }
}, },
"AGENT_AVAILABILITY": {
"IS_AVAILABLE": "είναι διαθέσιμο",
"ARE_AVAILABLE": "είναι διαθέσιμα",
"OTHERS_ARE_AVAILABLE": "άλλοι είναι διαθέσιμοι",
"AND": "και"
},
"POWERED_BY": "με την δύναμη του Chatwoot", "POWERED_BY": "με την δύναμη του Chatwoot",
"EMAIL_PLACEHOLDER": "Παρακαλώ εισάγετε το email σας", "EMAIL_PLACEHOLDER": "Παρακαλώ εισάγετε το email σας",
"CHAT_PLACEHOLDER": "Πληκτρολογήστε το μήνυμά σας" "CHAT_PLACEHOLDER": "Πληκτρολογήστε το μήνυμά σας"

View file

@ -8,6 +8,12 @@
"SUBMIT": "Submit" "SUBMIT": "Submit"
} }
}, },
"AGENT_AVAILABILITY": {
"IS_AVAILABLE": "is available",
"ARE_AVAILABLE": "are available",
"OTHERS_ARE_AVAILABLE": "others are available",
"AND": "and"
},
"POWERED_BY": "Powered by Chatwoot", "POWERED_BY": "Powered by Chatwoot",
"EMAIL_PLACEHOLDER": "Please enter your email", "EMAIL_PLACEHOLDER": "Please enter your email",
"CHAT_PLACEHOLDER": "Type your message" "CHAT_PLACEHOLDER": "Type your message"

View file

@ -8,6 +8,12 @@
"SUBMIT": "Envoyer" "SUBMIT": "Envoyer"
} }
}, },
"AGENT_AVAILABILITY": {
"IS_AVAILABLE": "est disponible",
"ARE_AVAILABLE": "sont disponibles",
"OTHERS_ARE_AVAILABLE": "autres sont disponibles",
"AND": "et"
},
"POWERED_BY": "Propulsé par Chatwoot", "POWERED_BY": "Propulsé par Chatwoot",
"EMAIL_PLACEHOLDER": "Veuillez saisir votre adresse de courriel", "EMAIL_PLACEHOLDER": "Veuillez saisir votre adresse de courriel",
"CHAT_PLACEHOLDER": "Tapez votre message" "CHAT_PLACEHOLDER": "Tapez votre message"

View file

@ -8,6 +8,12 @@
"SUBMIT": "Bevestigen" "SUBMIT": "Bevestigen"
} }
}, },
"AGENT_AVAILABILITY": {
"IS_AVAILABLE": "is beschikbaar",
"ARE_AVAILABLE": "zijn beschikbaar",
"OTHERS_ARE_AVAILABLE": "anderen zijn beschikbaar",
"AND": "en"
},
"POWERED_BY": "Mogelijk gemaakt door Chatwoot", "POWERED_BY": "Mogelijk gemaakt door Chatwoot",
"EMAIL_PLACEHOLDER": "Voer uw e-mailadres in", "EMAIL_PLACEHOLDER": "Voer uw e-mailadres in",
"CHAT_PLACEHOLDER": "Typ uw bericht" "CHAT_PLACEHOLDER": "Typ uw bericht"

View file

@ -0,0 +1,24 @@
export default {
methods: {
getAvailableAgentsText(agents) {
const count = agents.length;
if (count === 1) {
const [agent] = agents;
return `${agent.name} ${this.$t('AGENT_AVAILABILITY.IS_AVAILABLE')}`;
}
if (count === 2) {
const [first, second] = agents;
return `${first.name} ${this.$t('AGENT_AVAILABILITY.AND')} ${
second.name
} ${this.$t('AGENT_AVAILABILITY.ARE_AVAILABLE')}`;
}
const [agent] = agents;
const rest = agents.length - 1;
return `${agent.name} ${this.$t(
'AGENT_AVAILABILITY.AND'
)} ${rest} ${this.$t('AGENT_AVAILABILITY.OTHERS_ARE_AVAILABLE')}`;
},
},
};

View file

@ -0,0 +1,49 @@
import { createWrapper } from '@vue/test-utils';
import agentMixin from '../agentMixin';
import Vue from 'vue';
const translations = {
'AGENT_AVAILABILITY.IS_AVAILABLE': 'is available',
'AGENT_AVAILABILITY.ARE_AVAILABLE': 'are available',
'AGENT_AVAILABILITY.OTHERS_ARE_AVAILABLE': 'others are available',
'AGENT_AVAILABILITY.AND': 'and',
};
const TestComponent = {
render() {},
title: 'TestComponent',
mixins: [agentMixin],
methods: {
$t(key) {
return translations[key];
},
},
};
describe('agentMixin', () => {
test('returns correct text', () => {
const Constructor = Vue.extend(TestComponent);
const vm = new Constructor().$mount();
const wrapper = createWrapper(vm);
expect(wrapper.vm.getAvailableAgentsText([{ name: 'Pranav' }])).toEqual(
'Pranav is available'
);
expect(
wrapper.vm.getAvailableAgentsText([
{ name: 'Pranav' },
{ name: 'Nithin' },
])
).toEqual('Pranav and Nithin are available');
expect(
wrapper.vm.getAvailableAgentsText([
{ name: 'Pranav' },
{ name: 'Nithin' },
{ name: 'Subin' },
{ name: 'Sojan' },
])
).toEqual('Pranav and 3 others are available');
});
});

View file

@ -4,7 +4,7 @@
LANGUAGES_CONFIG = { LANGUAGES_CONFIG = {
0 => { name: 'English', iso_639_3_code: 'eng', iso_639_1_code: 'en', enabled: true }, 0 => { name: 'English', iso_639_3_code: 'eng', iso_639_1_code: 'en', enabled: true },
1 => { name: 'Arabic', iso_639_3_code: 'ara', iso_639_1_code: 'ar', enabled: false }, 1 => { name: 'Arabic', iso_639_3_code: 'ara', iso_639_1_code: 'ar', enabled: false },
2 => { name: 'Dutch', iso_639_3_code: 'nld', iso_639_1_code: 'nl', enabled: false }, 2 => { name: 'Dutch', iso_639_3_code: 'nld', iso_639_1_code: 'nl', enabled: true },
3 => { name: 'French', iso_639_3_code: 'fra', iso_639_1_code: 'fr', enabled: true }, 3 => { name: 'French', iso_639_3_code: 'fra', iso_639_1_code: 'fr', enabled: true },
4 => { name: 'German', iso_639_3_code: 'deu', iso_639_1_code: 'de', enabled: true }, 4 => { name: 'German', iso_639_3_code: 'deu', iso_639_1_code: 'de', enabled: true },
5 => { name: 'Hindi', iso_639_3_code: 'hin', iso_639_1_code: 'hi', enabled: false }, 5 => { name: 'Hindi', iso_639_3_code: 'hin', iso_639_1_code: 'hi', enabled: false },