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

Add localisation support #397

Merged
merged 32 commits into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
31209d0
Add language support
ph1p Nov 12, 2017
a24242e
Add language support to main process
ph1p Nov 12, 2017
e022f34
Add breaks to language config
ph1p Nov 12, 2017
d280a9b
Spanish translation with the help of google translator 🤙
ph1p Nov 12, 2017
ab5003c
Move language files
ph1p Nov 12, 2017
c87a691
Remove unused resolve from webpack config
ph1p Nov 12, 2017
1ec27bf
Add all items to setupMenu method to access translations
ph1p Nov 12, 2017
4f9ab34
Update packages
ph1p Nov 13, 2017
1dec0ef
Replace MinifyPlugin with UglifyJSPlugin, because of CALL_AND_RETRY_LAST
ph1p Nov 13, 2017
56d4149
Fix test bug (https://github.com/electron/spectron/issues/244)
ph1p Nov 13, 2017
7e643a3
Add i18n setup to file-manager.js
ph1p Nov 13, 2017
a687446
Fix archive button style (add space)
ph1p Nov 13, 2017
a151e77
Add enabled state to menu
ph1p Nov 13, 2017
9d8b2b2
Add webpack-alias plugin for better path resolving (webpack.config.ba…
ph1p Nov 13, 2017
eb5eab8
Update package-lock.json
ph1p Nov 13, 2017
ae899aa
Remove PWD from .babelrc
ph1p Nov 13, 2017
9cf203d
Add full translation (german, english)
ph1p Nov 14, 2017
41d5986
Add missing translations
ph1p Nov 14, 2017
07124f1
Add cache verification for npm on appveyor
perry-mitchell Nov 14, 2017
c8c1173
Update build file
ph1p Nov 14, 2017
bd6b1da
Merge branch 'master' of github.com:ph1p/buttercup-desktop
ph1p Nov 14, 2017
cece292
Add missing intl const
ph1p Nov 14, 2017
099d118
Set spectron to fixed version
ph1p Nov 14, 2017
0e7f3b6
Add missing translations to main menu
ph1p Nov 14, 2017
06b6758
Fix language & config lookup
sallar Nov 14, 2017
41b5cef
Merge branch 'master' of github.com:ph1p/buttercup-desktop
sallar Nov 14, 2017
6b28025
Revert upgraded deps
sallar Nov 14, 2017
6be7cd1
Upgrade webpack and babel
sallar Nov 14, 2017
1511207
Update more deps
sallar Nov 14, 2017
b64d210
Revert package-lock file
sallar Nov 14, 2017
0db4b88
Remove unnecessary scope in i18n setup
ph1p Nov 14, 2017
e04411e
Fix i18n import path
ph1p Nov 14, 2017
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
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"transform-object-rest-spread",
"transform-strict-mode",
"transform-class-properties",
"jsx-control-statements"
"jsx-control-statements",
["webpack-alias", { "config": "./config/webpack.config.base.js" } ]
],
"env": {
"production": {
Expand Down
11 changes: 7 additions & 4 deletions config/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ module.exports = {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
use: 'babel-loader',
include: [
join(__dirname, '../src'),
join(__dirname, '../node_modules/buttercup-generator')
]
},
{
test: /\.(svg|png|ttf|woff|woff2)$/,
loader: 'file-loader',
use: 'file-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
use: ['style-loader', 'css-loader']
}
]
},
Expand All @@ -28,7 +28,10 @@ module.exports = {
libraryTarget: 'commonjs2'
},
resolve: {
extensions: ['.js', '.jsx', '.json', '.scss']
extensions: ['.js', '.jsx', '.json', '.scss'],
alias: {
locales: join(__dirname, '../locales')
}
},
plugins: [],
externals: ['buttercup-importer', 'zxcvbn', 'dropbox', 'webdav', 'conf']
Expand Down
61 changes: 52 additions & 9 deletions config/webpack.config.production.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { resolve } = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const BabiliPlugin = require('babili-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const baseConfig = require('./webpack.config.base');

module.exports = merge(baseConfig, {
Expand All @@ -21,18 +21,40 @@ module.exports = merge(baseConfig, {
rules: [
{
test: /\.global\.scss$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: 'css-loader!sass-loader'
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
minimize: true
}
},
{
loader: 'sass-loader'
}
]
})
},

{
test: /^((?!\.global).)*\.scss$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader:
'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass-loader'
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: true,
localIdentName: '[name]__[local]___[hash:base64:5]',
minimize: true
}
},
{
loader: 'sass-loader'
}
]
})
}
]
Expand All @@ -47,7 +69,28 @@ module.exports = merge(baseConfig, {
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new BabiliPlugin(),
new UglifyJSPlugin({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does uglifyJS support ES6 which we are using? I think the reason I used Babili was that it was the only one that supported ES6 out of the box.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jep. Documentation says, that i can use the ecma option (https://github.com/webpack-contrib/uglifyjs-webpack-plugin#uglifyoptions)

parallel: true,
exclude: /\/node_modules/,
uglifyOptions: {
ecma: 8,
mangle: true,
compress: {
sequences: true,
dead_code: true,
conditionals: true,
booleans: true,
unused: true,
if_return: true,
join_vars: true,
drop_console: true
},
output: {
comments: false,
beautify: false
}
}
}),
new ExtractTextPlugin({
filename: '[name].css',
allChunks: true
Expand Down
20 changes: 20 additions & 0 deletions locales/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"welcome-back-title": "Willkommen zurück bei Buttercup.",
"unlock-archive": "Entsperre ein Archiv um zu starten ({os}).",
"welcome-title": "Willkommen bei Buttercup.",
"welcome-caption": "Du hast bis jetzt noch keine Archive. Warum fügst du nicht eins hinzu?",
"open-archive-file": "Archiv öffnen",
"new-archive-file": "Archiv erstellen",
"connect-cloud-sources": "Einen Cloud Services verbinden",
"add-archive": "Archiv hinzufügen",
"cancel": "Abbrechen",
"go-back": "Zurück",
"new-archive": "Neues Archiv",
"open-in-buttercup": "Mit Buttercup öffnen",
"master-password": "Master Passwort",
"confirm": "Bestätigen",
"nevermind": "Abbrechen",
"password": "Passwort",
"language": "Sprache",
"copy-to-clipboard": "In die Zwischenablage kopieren"
}
20 changes: 20 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"welcome-back-title": "Welcome back to Buttercup.",
"unlock-archive": "Unlock an archive to begin ({os}).",
"welcome-title": "Welcome to Buttercup.",
"welcome-caption": "You haven't added any archives yet. Why not add one?",
"open-archive-file": "Open Archive File",
"new-archive-file": "New Archive File",
"connect-cloud-sources": "Connect Cloud Sources",
"add-archive": "Add Archive",
"cancel": "Cancel",
"go-back": "Go Back",
"new-archive": "New Archive",
"open-in-buttercup": "Open in Buttercup",
"master-password": "Master Password",
"confirm": "Confirm",
"nevermind": "Nevermind",
"password": "Password",
"language": "Language",
"copy-to-clipboard": "Copy To Clipboard"
}
20 changes: 20 additions & 0 deletions locales/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"welcome-back-title": "Bienvenido de nuevo a Buttercup.",
"unlock-archive": "Desbloquee un archivo para comenzar ({os}).",
"welcome-title": "Bienvenido a Buttercup.",
"welcome-caption":"Aún no ha agregado ningún archivo. ¿Por qué no agregar uno?",
"open-archive-file": "Abrir archivo de archivo",
"new-archive-file": "Nuevo archivo archivado",
"connect-cloud-sources": "Connect Cloud Sources",
"add-archive": "Agregar archivo",
"cancel": "Cancelar",
"go-back": "Volver atrás",
"new-archive": "Nuevo archivo",
"open-in-buttercup": "Abrir en Buttercup",
"master_password": "Contraseña maestra",
"confirm": "Confirmar",
"nevermind": "No importa",
"password": "Contraseña",
"language": "Idioma",
"copy-to-clipboard": "Copiar al portapapeles"
}
Loading