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
16 changed files with 216 additions and 107 deletions

View File

@@ -1,12 +1,13 @@
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 el from './locale/el';
import en from './locale/en';
import fr from './locale/fr';
import nl from './locale/nl';
import ml from './locale/ml';
import pt from './locale/pt';
import pt_BR from './locale/pt_BR';
import ro from './locale/ro';
export default {
ca,
@@ -14,6 +15,7 @@ export default {
el,
en,
fr,
nl,
ml,
pt_BR,
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>
import GroupedAvatars from 'widget/components/GroupedAvatars.vue';
import { getAvailableAgentsText } from 'widget/helpers/utils';
import agentMixin from '../mixins/agentMixin';
export default {
name: 'AvailableAgents',
components: { GroupedAvatars },
mixins: [agentMixin],
props: {
agents: {
type: Array,
@@ -37,7 +38,7 @@ export default {
}));
},
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": "إرسال"
}
},
"AGENT_AVAILABILITY": {
"IS_AVAILABLE": "is available",
"ARE_AVAILABLE": "are available",
"OTHERS_ARE_AVAILABLE": "others are available",
"AND": "and"
},
"POWERED_BY": "مدعوم بواسطة Chatwoot",
"EMAIL_PLACEHOLDER": "الرجاء إدخال بريدك الإلكتروني",
"CHAT_PLACEHOLDER": "أكتب رسالتك"

View File

@@ -8,6 +8,12 @@
"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",
"EMAIL_PLACEHOLDER": "Introduïu el vostre correu electrònic",
"CHAT_PLACEHOLDER": "Escriu el teu missatge"

View File

@@ -8,6 +8,12 @@
"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",
"EMAIL_PLACEHOLDER": "Bitte geben Sie ihre E-Mail-Adresse ein",
"CHAT_PLACEHOLDER": "Geben Sie Ihre Nachricht ein"

View File

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

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": "Powered by Chatwoot",
"EMAIL_PLACEHOLDER": "Please enter your email",
"CHAT_PLACEHOLDER": "Type your message"

View File

@@ -8,6 +8,12 @@
"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",
"EMAIL_PLACEHOLDER": "Veuillez saisir votre adresse de courriel",
"CHAT_PLACEHOLDER": "Tapez votre message"

View File

@@ -8,6 +8,12 @@
"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",
"EMAIL_PLACEHOLDER": "Voer uw e-mailadres in",
"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');
});
});