Skip to content
Snippets Groups Projects
Commit 1f856156 authored by Renato Becker's avatar Renato Becker Committed by Diego Sampaio
Browse files

[FIX] Livechat translation files being ignored (#10369)

* The Livechat translation files have been moved to Rocket.Chat translation package.

* Fix en translation on livechat

* Add README
parent 2c856c0b
No related branches found
No related tags found
No related merge requests found
Showing
with 34 additions and 9 deletions
......@@ -73,3 +73,4 @@ pm2.json
settings.json
build.sh
/public/livechat
packages/rocketchat-i18n/i18n/livechat.*
This package contains internationalization for Rocket.Chat.
Due to limitations of the i18n-library used, _only_ translations from this very folder will be respected.
Thus, if you extend Rocket.Chat with custom packages which have got own translation files, you'll have to put them into this package. They should be named `<package>.<language>.i18n.(json|yaml)`.
Alternatively, you can add the i18n-files in your package and then copy it to this folder during build time. In this case, you should add the copied files to the `.gitignore`. See [how livechat did](../package.js) as an example.
......@@ -10,11 +10,21 @@ Package.onUse(function(api) {
const fs = Npm.require('fs');
const workingDir = process.env.PWD || '.';
fs.readdirSync(`${ workingDir }/packages/rocketchat-i18n/i18n`).forEach(function(filename) {
if (filename.indexOf('.json') > -1 && fs.statSync(`${ workingDir }/packages/rocketchat-i18n/i18n/${ filename }`).size > 16) {
const i18nDir = `${ workingDir }/packages/rocketchat-i18n/i18n`;
fs.readdirSync(i18nDir).forEach(function(filename) {
if (filename.indexOf('.json') > -1 && fs.statSync(`${ i18nDir }/${ filename }`).size > 16) {
api.addFiles(`i18n/${ filename }`);
}
});
const livechatDir = `${ workingDir }/packages/rocketchat-livechat/.app/i18n`;
fs.readdirSync(livechatDir).forEach(function(filename) {
if (filename.indexOf('.json') > -1 && fs.statSync(`${ livechatDir }/${ filename }`).size > 16) {
fs.writeFileSync(`${ i18nDir }/livechat.${ filename }`, fs.readFileSync(`${ livechatDir }/${ filename }`));
api.addFiles(`i18n/livechat.${ filename }`);
}
});
api.use('tap:i18n@1.8.2');
});
......@@ -17,10 +17,11 @@ this.Commands = {
if (Livechat.transcript) {
const visitorData = visitor.getData();
const email = visitorData && visitorData.visitorEmails && visitorData.visitorEmails.length > 0 ? visitorData.visitorEmails[0].address : '';
const transcriptMessage = (!_.isEmpty(Livechat.transcriptMessage)) ? Livechat.transcriptMessage : (TAPi18n.__('Would_you_like_a_copy_if_this_chat_emailed'));
swal({
title: t('Chat_ended'),
text: Livechat.transcriptMessage,
text: transcriptMessage,
type: 'input',
inputValue: email,
showCancelButton: true,
......
......@@ -26,7 +26,7 @@
</svg>
{{/if}}
{{#unless popoutActive}}
<svg class="popout" aria-label="{{_ "Open in a new window"}}" viewBox="0 0 448 448" xmlns="http://www.w3.org/2000/svg">
<svg class="popout" aria-label="{{_ "Open_in_a_new_window"}}" viewBox="0 0 448 448" xmlns="http://www.w3.org/2000/svg">
<path d="M320 232v-120c0-8.75-7.25-16-16-16h-120c-6.5 0-12.25 4-14.75 9.75-2.5 6-1.25 13 3.5 17.5l36 36-133.5 133.5c-6.25 6.25-6.25 16.25 0 22.5l25.5 25.5c6.25 6.25 16.25 6.25 22.5 0l133.5-133.5 36 36c3 3.25 7 4.75 11.25 4.75 2 0 4.25-0.5 6.25-1.25 5.75-2.5 9.75-8.25 9.75-14.75zM384 104v240c0 39.75-32.25 72-72 72h-240c-39.75 0-72-32.25-72-72v-240c0-39.75 32.25-72 72-72h240c39.75 0 72 32.25 72 72z"></path>
</svg>
{{/unless}}
......
<template name="loading">
<div class="loading-animation">
{{_ "Connecting to an Agent"}}
{{_ "Connecting_to_an_Agent"}}
<div class="bounce bounce1"></div>
<div class="bounce bounce2"></div>
<div class="bounce bounce3"></div>
......
......@@ -8,6 +8,9 @@ Template.offlineForm.helpers({
messageSent() {
return Template.instance().messageSent.get();
},
offlineMessage() {
return (!_.isEmpty(this.offlineMessage)) ? this.offlineMessage.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br>$2') : TAPi18n.__('We_are_not_online_right_now_please_leave_a_message');
},
offlineSuccessMessage() {
if (!_.isEmpty(this.offlineSuccessMessage)) {
return this.offlineSuccessMessage.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br>$2');
......
......@@ -39,7 +39,8 @@
"Type_your_name": "Type your name",
"User_joined": "User joined",
"User_left": "User left",
"We_are_offline_Sorry_for_the_inconvenience": "We are offline. Sorry for the inconvenience.",
"We_are_not_online_right_now_please_leave_a_message": "We are not online right now. Please, leave a message.",
"We_are_offline_Sorry_for_the_inconvenience": "We are offline. Sorry for the inconvenience.",
"Yes": "Yes",
"You": "You",
"You_must_complete_all_fields": "You must complete all fields"
......
......@@ -39,6 +39,7 @@
"Type_your_name": "Digite seu nome",
"User_joined": "Usuário entrou",
"User_left": "Usuário saiu",
"We_are_not_online_right_now_please_leave_a_message": "Nós não estamos online agora. Por favor, deixe uma mensagem.",
"We_are_offline_Sorry_for_the_inconvenience": "Nós estamos offline. Desculpe pelo inconveniente.",
"Yes": "Sim",
"You": "Você",
......
{
}
......@@ -23,7 +23,7 @@ Template.livechatOfficeHours.helpers({
},
name(day) {
return day.day;
return TAPi18n.__(day.day);
},
open(day) {
return Template.instance().dayVars[day.day].open.get();
......
......@@ -44,7 +44,7 @@ Meteor.startup(function() {
section: 'Offline',
i18nLabel: 'Color'
});
RocketChat.settings.add('Livechat_offline_message', 'We are not online right now. Please leave us a message:', {
RocketChat.settings.add('Livechat_offline_message', '', {
type: 'string',
group: 'Livechat',
public: true,
......@@ -223,7 +223,7 @@ Meteor.startup(function() {
i18nLabel: 'Transcript_Enabled'
});
RocketChat.settings.add('Livechat_transcript_message', 'Would you like a copy of this chat emailed?', {
RocketChat.settings.add('Livechat_transcript_message', '', {
type: 'string',
group: 'Livechat',
public: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment