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

Support multiple languages #187

Merged
merged 43 commits into from
Feb 2, 2018
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0d7fe7b
Added i18next packages
hql287 Jan 22, 2018
899bf5f
Added i18next to mainWindow
hql287 Jan 22, 2018
93d3181
Allows user to set default language
hql287 Jan 22, 2018
d2d55e3
Added translation
hql287 Jan 22, 2018
d6f525e
Translated components
hql287 Jan 22, 2018
471805f
Converted js to json
hql287 Jan 23, 2018
6adf402
Added & refactored translations
hql287 Jan 24, 2018
7ffa431
Uddated English Translation
hql287 Jan 24, 2018
6361600
Fixed Tests
hql287 Jan 25, 2018
5f6a6a5
Merge branch 'dev' into multiple-languages
hql287 Jan 26, 2018
4d1a665
Removed date-fns, use moment instead.
hql287 Jan 27, 2018
d0bae24
Fixed typos
hql287 Jan 27, 2018
6fd7abf
Added Invoices translation
hql287 Jan 27, 2018
ae7f30d
Translated Invoices & Invoice components
hql287 Jan 27, 2018
5c6422e
Added Fr & Vi translations
hql287 Jan 27, 2018
aa2e7d7
Replaced date-fns with moment
hql287 Jan 27, 2018
1907532
Fixed Tests
hql287 Jan 27, 2018
afb639c
Translated Contacts tab & added empty messages translation
hql287 Jan 29, 2018
05483fe
Keep i18n with moment in sync
hql287 Jan 29, 2018
a862b2e
Refactored Invoices/Invoice component and tests
hql287 Jan 29, 2018
15f5c30
Translated Notifications
hql287 Jan 29, 2018
d775279
Added missing translation for English & French
hql287 Jan 29, 2018
8569bb5
Converted Dialog windows to React component
hql287 Jan 29, 2018
2dafbbd
Updated Webpack Config
hql287 Jan 29, 2018
9e37b61
Removed unused component
hql287 Jan 29, 2018
501278e
Added dialog & common translations
hql287 Jan 29, 2018
265c8bb
Refactored components
hql287 Jan 29, 2018
06301d6
Refactored helpers
hql287 Jan 29, 2018
cf6fba3
Added missing translation
hql287 Jan 29, 2018
3c41aaa
Fixed Tests
hql287 Jan 30, 2018
f0bde11
Added translation for tourWindow & previewWindow
hql287 Jan 31, 2018
4bc4d52
Refactored previewWindow components
hql287 Jan 31, 2018
20593d7
Refactored templates
hql287 Jan 31, 2018
cd2fb73
Refactored tourWindow components
hql287 Jan 31, 2018
8eee3e8
Fixed snapshot
hql287 Jan 31, 2018
0ab2b40
Fixed typos
hql287 Jan 31, 2018
5a490fa
Fixed Typos
hql287 Jan 31, 2018
8fb98de
Merge branch 'dev' into multiple-languages
hql287 Feb 1, 2018
e9aaaff
Fixed typos
hql287 Feb 1, 2018
91d60cf
Fixed test
hql287 Feb 1, 2018
171e7c3
Updated Vietnamese Translation
hql287 Feb 2, 2018
32df196
Updated French translation
hql287 Feb 2, 2018
1658748
Updated English Translation
hql287 Feb 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Translated Contacts tab & added empty messages translation
hql287 committed Jan 29, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit afb639c34fc33653736f8cab02e9aedff7eb279e
23 changes: 13 additions & 10 deletions app/containers/Contacts.jsx
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import { compose } from 'recompose';
import { connect } from 'react-redux';
const openDialog = require('../renderers/dialog.js');
const ipc = require('electron').ipcRenderer;
import { translate } from 'react-i18next';

// Actions
import * as ContactsActions from '../actions/contacts';
@@ -69,7 +70,7 @@ class Contacts extends PureComponent {
}

render() {
const { contacts } = this.props;
const { t, contacts } = this.props;
const contactsComponent = contacts.map((contact, index) => (
<Contact
key={contact._id}
@@ -82,19 +83,19 @@ class Contacts extends PureComponent {
return (
<PageWrapper>
<PageHeader>
<PageHeaderTitle>All Contacts</PageHeaderTitle>
<PageHeaderTitle>{t('contacts:header')}</PageHeaderTitle>
</PageHeader>
<PageContent>
{contacts.length === 0 ? (
<Message info text="You don't have any contacts yet!" />
<Message info text={t('messages:noContact')} />
) : (
<Table hasBorders bg>
<THead>
<TR>
<TH>Contact</TH>
<TH>Email</TH>
<TH>Phone</TH>
<TH actions>Actions</TH>
<TH>{t('contacts:fields:contact')}</TH>
<TH>{t('contacts:fields:email')}</TH>
<TH>{t('contacts:fields:phone')}</TH>
<TH actions>{t('contacts:fields:actions')}</TH>
</TR>
</THead>
<TBody>{contactsComponent}</TBody>
@@ -117,6 +118,8 @@ const mapStateToProps = state => ({
contacts: getContacts(state),
});

export default compose(connect(mapStateToProps), _withFadeInAnimation)(
Contacts
);
export default compose(
connect(mapStateToProps),
translate(['common', 'form']),
_withFadeInAnimation
)(Contacts);
2 changes: 1 addition & 1 deletion app/containers/Invoices.jsx
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ class Invoices extends PureComponent {
</PageHeader>
<PageContent bare>
{invoices.length === 0 ? (
<Message info text="You don't have any invoice yet" />
<Message info text={t('messages:noInvoice')} />
) : (
<div className="row">{invoicesComponent}</div>
)}
12 changes: 12 additions & 0 deletions i18n/en/contacts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"header": {
"name": "All Contacts"
},
"fields": {
"client": "Client",
"invoiceID": "Invoice ID",
"createdDate": "Created On",
"dueDate": "Due Date",
"total": "Total Value"
}
}
10 changes: 7 additions & 3 deletions i18n/en/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import form from './form.json';
import settings from './settings.json';
import common from './common.json';
import contacts from './contacts.json';
import form from './form.json';
import invoices from './invoices.json';
import messages from './messages.json';
import settings from './settings.json';

export default {
common,
contacts,
form,
invoices,
messages,
settings,
common,
}
4 changes: 4 additions & 0 deletions i18n/en/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noContact": "You don't have any contact yet",
"noInvoice": "You haven't created any invoice yet"
}
12 changes: 12 additions & 0 deletions i18n/fr/contacts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"header": {
"name": "All Contacts"
},
"fields": {
"client": "Client",
"invoiceID": "Invoice ID",
"createdDate": "Created On",
"dueDate": "Due Date",
"total": "Total Value"
}
}
10 changes: 7 additions & 3 deletions i18n/fr/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import form from './form.json';
import settings from './settings.json';
import common from './common.json';
import contacts from './contacts.json';
import form from './form.json';
import invoices from './invoices.json';
import messages from './messages.json';
import settings from './settings.json';

export default {
common,
contacts,
form,
invoices,
messages,
settings,
common,
}
4 changes: 4 additions & 0 deletions i18n/fr/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noContact": "You don't have any contact yet",
"noInvoice": "You haven't created any invoice yet"
}
2 changes: 1 addition & 1 deletion i18n/i18n.js
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ i18n
lng: defaultLanguage,
fallbackLng: 'en',
debug: isDev,
ns: ['form', 'common', 'invoices'],
// ns: ['form', 'common', 'invoices'],
defaultNS: 'form',
resources: {
en,
9 changes: 9 additions & 0 deletions i18n/vi/contacts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"header": "Danh Sách Khách Hàng",
"fields": {
"contact": "Khách hàng",
"email": "Thư điện tử",
"phone": "Điện thoại",
"actions": "Tác Vụ"
}
}
10 changes: 7 additions & 3 deletions i18n/vi/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import form from './form.json';
import settings from './settings.json';
import common from './common.json';
import contacts from './contacts.json';
import form from './form.json';
import invoices from './invoices.json';
import messages from './messages.json';
import settings from './settings.json';

export default {
common,
contacts,
form,
invoices,
messages,
settings,
common,
}
4 changes: 4 additions & 0 deletions i18n/vi/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noContact": "Bạn chưa có khách hàng nào trong danh sách",
"noInvoice": "Bạn chưa tạo hoá đơn nào"
}