Commit 5fc984f3 authored by  JosephK's avatar JosephK
Browse files

Img i18n

parent 115aafd8
......@@ -24,8 +24,8 @@
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<img class="img-responsive" alt=""
title="Clic droit sur l’image et « Enregistrer l’image sous » pour la réutiliser"
:src="$root['/'] + 'img/infographie_Le-Monde-de-Framasoft_CC-By-SA-Geoffrey-Dorne-1920px-2018-' + ($t('lang') === 'fr' ? 'fr' : 'en') + '.jpg'" />
:title="$t('asso.prez.saveas')"
:src="`${$root['/']}img/${$route.meta.lang}/infographie_Le-Monde-de-Framasoft_CC-By-SA-Geoffrey-Dorne-1920px-2018.jpg`" />
<p class="text-right">
<span v-html="$t('asso.prez.infography')"></span>
<a href="http://geoffreydorne.com" v-html="$root.people.dorme"></a>, <span v-html="$root.license.ccbysa4fr"></span>
......
......@@ -233,7 +233,7 @@
<div class="row col-md-12">
<figure id="pingouinsQuelquesBriques">
<img :src="$root['/'] + 'img/quelques-briques_licence-art-libre.jpg'" alt="" />
<img :src="`${$root['/']}img/${$t('lang')}/quelques-briques_licence-art-libre.jpg`" alt="" />
</figure>
</div>
......
......@@ -5,7 +5,7 @@
aria-hidden="true">
<a :href="image.link">
<img
:src="`${$root['/']}img/${image.src}`"
:src="`${$root['/']}img/${$t('lang')}/${image.src}`"
:alt="image.alt"
class="img-responsive" />
</a>
......
......@@ -842,6 +842,7 @@ asso:
- of free software (directory, USB sticks, installer…);
- of free cultural creations (blog, translation, publishing house…);
- of free services (more than 30 free services in the project <a href="@:data.link.dio">@:color.dio</a>).
saveas: Right click on the image and “Save image as” to reuse it
infography: Infography <em lang="fr">Le monde de @:data.txt.soft</em> made by
infos:
title: The @:data.txt.soft association
......
......@@ -889,6 +889,7 @@ asso:
- de logiciels libres (annuaire, clés USB, installateur…) ;
- de créations culturelles libres (blog, traduction, maison d’édition…) ;
- de services libres (plus de 30 dans le projet <a href="@:data.link.dio">@:color.dio</a>).
saveas: Clic droit sur l’image et « Enregistrer l’image sous » pour la réutiliser
infography: Infographie <em>Le monde de @:data.txt.soft</em> réalisée par
infos:
title: L’association @:data.txt.soft
......
......@@ -6,9 +6,9 @@
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot --mode development",
"preview": "cross-env NODE_ENV=preview webpack --progress --hide-modules --mode production",
"prod": "cross-env NODE_ENV=production webpack --progress --hide-modules --mode production"
"dev": "rm -rf ./public && cross-env NODE_ENV=development webpack-dev-server --open --hot --mode development",
"preview": "rm -rf ./public && cross-env NODE_ENV=preview webpack --progress --hide-modules --mode production",
"prod": "rm -rf ./public && cross-env NODE_ENV=production webpack --progress --hide-modules --mode production"
},
"dependencies": {
"bootstrap-sass": "^3.3.7",
......
......@@ -109,15 +109,29 @@ let config = {
module.exports = config;
if (process.env.NODE_ENV !== 'development') {
// NODE_ENV === 'production|preview'
const locales = [];
// Import locales list
fs.readdirSync('./app/locales').forEach(file => {
locales.push(file.replace(/(.*)\.yml/, '$1'));
});
if (process.env.NODE_ENV === 'development') {
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"development"',
BASE_URL: '""',
},
}),
new HtmlWebpackPlugin({
title: 'DEVELOPMENT prerender-spa-plugin',
template: 'index.html',
filename: 'index.html',
}),
]);
} else { // NODE_ENV === 'production|preview'
const routes = [root];
const locales = [];
const pages = [];
// Import locales list
fs.readdirSync('./app/locales').forEach(file => {
locales.push(file.replace(/(.*)\.yml/, '$1'));
});
// Import pages list
fs.readdirSync('./app/components/pages').forEach(file => {
pages.push(file.replace(/(.*)\.vue/, '$1'));
......@@ -168,20 +182,25 @@ if (process.env.NODE_ENV !== 'development') {
}),
}),
);
} else {
// NODE_ENV === 'development'
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"development"',
BASE_URL: '""',
},
}),
new HtmlWebpackPlugin({
title: 'DEVELOPMENT prerender-spa-plugin',
template: 'index.html',
filename: 'index.html',
}),
]);
}
// Create ./public/img/lg/* symlinks only if images need translation
if (fs.existsSync('./app/assets/img/fr')) {
if (!fs.existsSync('./public')){ fs.mkdirSync('./public'); }
if (!fs.existsSync('./public/img')){ fs.mkdirSync('./public/img'); }
for (let i = 0; i < locales.length; i += 1) {
if (!fs.existsSync(`./public/img/${locales[i]}`)){
fs.mkdirSync(`./public/img/${locales[i]}`);
}
fs.readdirSync('./app/assets/img/fr').forEach(file => {
if (!fs.existsSync(`./app/assets/img/${locales[i]}/${file}`)) {
const symlinkOrigin = (process.env.NODE_ENV === 'development')
? `../../../app/assets/img/fr/${file}` // [dev] relative to assets
: `../fr/${file}` // [prod] relative to public
fs.symlink(symlinkOrigin, `./public/img/${locales[i]}/${file}`,
function (err) { console.log(err); } // eslint-disable-line
);
}
});
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment