Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Framasoft
framacalc
Commits
7564433b
Commit
7564433b
authored
Nov 05, 2020
by
JosephK
Browse files
Merge branch 'master' into 'master'
♻
️ vue-fs 20.9.1 See merge request
!9
parents
c52f0748
9cd41f8e
Pipeline
#359428
passed with stages
in 1 minute and 6 seconds
Changes
23
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
7564433b
...
...
@@ -12,9 +12,9 @@ test:
pages
:
stage
:
deploy
script
:
-
npm
install
-
npm
run commons
-
npm run preview
-
mv -f public/$
CI_PROJECT_NAME
/* public
-
mv -f public/$
(echo $CI_PAGES_URL | cut -d/ -f4-)
/* public
-
find public -type f -iregex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -execdir gzip -f --keep {} \;
artifacts
:
paths
:
...
...
@@ -35,7 +35,7 @@ pages:
production
:
stage
:
deploy
script
:
-
npm
install
-
npm
run commons
-
npm run prod
-
cp ./public/fr/index.html ./public/index.html
-
for f in $(find -type l);do cp --remove-destination $(readlink -f $f) $f;done;
...
...
app/App.vue
View file @
7564433b
...
...
@@ -36,9 +36,11 @@ import HeaderComponent from './components/partials/Header.vue';
export
default
{
name
:
'
App
'
,
components
:
{
HeaderComponent
,
},
data
()
{
const
description
=
this
.
$te
(
`meta.
${
this
.
$route
.
meta
.
id
}
.description`
)
?
this
.
$t
(
`meta.
${
this
.
$route
.
meta
.
id
}
.description`
)
...
...
@@ -62,12 +64,13 @@ export default {
author
:
this
.
$te
(
'
meta.author
'
)
?
this
.
$t
(
'
meta.author
'
)
:
''
,
img
:
`
${
this
.
$t
(
'
baseurl
'
)}
img/opengraph/
${
this
.
$route
.
meta
.
id
}
.jpg`
,
url
:
`
${
this
.
$t
(
'
meta.canonical
'
)}${
this
.
$route
.
path
}
`
,
favicon
:
`
${
this
.
$t
(
'
baseurl
'
)}
icons/favicon.png`
,
appleicon
:
`
${
this
.
$t
(
'
baseurl
'
)}
icons/apple-touch-icon.png`
,
favicon
:
`
${
this
.
$t
(
'
baseurl
'
)}
img/
icons/favicon.png`
,
appleicon
:
`
${
this
.
$t
(
'
baseurl
'
)}
img/
icons/apple-touch-icon.png`
,
},
i18n
:
process
.
env
.
NODE_ENV
=
==
'
development
'
?
this
.
$i18n
.
messages
:
''
,
i18n
:
process
.
env
.
NODE_ENV
!
==
'
prod
'
?
this
.
$i18n
.
messages
:
''
,
};
},
created
()
{
if
(
this
.
$route
.
meta
.
lang
!==
undefined
&&
this
.
$i18n
.
locale
!==
this
.
$route
.
meta
.
lang
)
{
...
...
app/assets/icons/apple-touch-icon.png
→
app/assets/
img/
icons/apple-touch-icon.png
View file @
7564433b
File moved
app/assets/img/icons/fa/solid/cloud.svg
0 → 100644
View file @
7564433b
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 640 512"
><path
d=
"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4z"
/></svg>
\ No newline at end of file
app/assets/img/icons/fa/solid/egg.svg
0 → 100644
View file @
7564433b
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 384 512"
><path
d=
"M192 0C86 0 0 214 0 320s86 192 192 192 192-86 192-192S298 0 192 0z"
/></svg>
\ No newline at end of file
app/assets/img/icons/fa/solid/language.svg
0 → 100644
View file @
7564433b
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 640 512"
><path
d=
"M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z"
/></svg>
\ No newline at end of file
app/assets/img/icons/fa/solid/leaf.svg
0 → 100644
View file @
7564433b
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 576 512"
><path
d=
"M546.2 9.7c-5.6-12.5-21.6-13-28.3-1.2C486.9 62.4 431.4 96 368 96h-80C182 96 96 182 96 288c0 7 .8 13.7 1.5 20.5C161.3 262.8 253.4 224 384 224c8.8 0 16 7.2 16 16s-7.2 16-16 16C132.6 256 26 410.1 2.4 468c-6.6 16.3 1.2 34.9 17.5 41.6 16.4 6.8 35-1.1 41.8-17.3 1.5-3.6 20.9-47.9 71.9-90.6 32.4 43.9 94 85.8 174.9 77.2C465.5 467.5 576 326.7 576 154.3c0-50.2-10.8-102.2-29.8-144.6z"
/></svg>
\ No newline at end of file
app/assets/img/icons/fa/solid/plus.svg
0 → 100644
View file @
7564433b
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 448 512"
><path
d=
"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"
/></svg>
\ No newline at end of file
app/assets/img/icons/fa/solid/question-circle.svg
0 → 100644
View file @
7564433b
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 512 512"
><path
d=
"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z"
/></svg>
\ No newline at end of file
app/assets/img/icons/fa/solid/th.svg
0 → 100644
View file @
7564433b
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 512 512"
><path
d=
"M149.333 56v80c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V56c0-13.255 10.745-24 24-24h101.333c13.255 0 24 10.745 24 24zm181.334 240v-80c0-13.255-10.745-24-24-24H205.333c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24h101.333c13.256 0 24.001-10.745 24.001-24zm32-240v80c0 13.255 10.745 24 24 24H488c13.255 0 24-10.745 24-24V56c0-13.255-10.745-24-24-24H386.667c-13.255 0-24 10.745-24 24zm-32 80V56c0-13.255-10.745-24-24-24H205.333c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24h101.333c13.256 0 24.001-10.745 24.001-24zm-205.334 56H24c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24h101.333c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24zM0 376v80c0 13.255 10.745 24 24 24h101.333c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H24c-13.255 0-24 10.745-24 24zm386.667-56H488c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H386.667c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24zm0 160H488c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H386.667c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24zM181.333 376v80c0 13.255 10.745 24 24 24h101.333c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H205.333c-13.255 0-24 10.745-24 24z"
/></svg>
\ No newline at end of file
app/assets/img/icons/fa/solid/times.svg
0 → 100644
View file @
7564433b
<svg
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 352 512"
><path
d=
"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
/></svg>
\ No newline at end of file
app/assets/icons/favicon.png
→
app/assets/
img/
icons/favicon.png
View file @
7564433b
File moved
app/assets/scss/fonts/dejavu-sans.scss
View file @
7564433b
@font-face
{
font-family
:
'DejaVu Sans'
;
src
:
url('~vuefs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-webfont.woff2')
format
(
'woff2'
)
,
url('~vuefs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-webfont.woff')
format
(
'woff'
);
src
:
url('~vue
-
fs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-webfont.woff2')
format
(
'woff2'
)
,
url('~vue
-
fs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-webfont.woff')
format
(
'woff'
);
}
@font-face
{
font-family
:
'DejaVu Sans'
;
src
:
url('~vuefs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-oblique-webfont.woff2')
format
(
'woff2'
)
,
url('~vuefs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-oblique-webfont.woff')
format
(
'woff'
);
src
:
url('~vue
-
fs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-oblique-webfont.woff2')
format
(
'woff2'
)
,
url('~vue
-
fs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-oblique-webfont.woff')
format
(
'woff'
);
font-weight
:
400
;
font-style
:
italic
;
}
@font-face
{
font-family
:
'DejaVu Sans'
;
src
:
url('~vuefs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-bold-webfont.woff2')
format
(
'woff2'
)
,
url('~vuefs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-bold-webfont.woff')
format
(
'woff'
);
src
:
url('~vue
-
fs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-bold-webfont.woff2')
format
(
'woff2'
)
,
url('~vue
-
fs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-bold-webfont.woff')
format
(
'woff'
);
font-weight
:
700
;
font-style
:
normal
;
}
@font-face
{
font-family
:
'DejaVu Sans'
;
src
:
url('~vuefs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-bold-oblique-webfont.woff2')
format
(
'woff2'
)
,
url('~vuefs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-bold-oblique-webfont.woff')
format
(
'woff'
);
src
:
url('~vue
-
fs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-bold-oblique-webfont.woff2')
format
(
'woff2'
)
,
url('~vue
-
fs-commons/app/assets/fonts/dejavu-sans/dejavu-sans-bold-oblique-webfont.woff')
format
(
'woff'
);
font-weight
:
700
;
font-style
:
italic
;
}
...
...
app/assets/scss/frama/bootstrap4.scss
View file @
7564433b
@import
'~vuefs-commons/app/assets/scss/frama/bootstrap4/colors'
;
@import
'~vuefs-commons/app/assets/scss/frama/bootstrap4/links'
;
@import
'~vuefs-commons/app/assets/scss/frama/bootstrap4/carousel'
;
\ No newline at end of file
@import
'~vue-fs-commons/app/assets/scss/frama/bootstrap4/alert'
;
@import
'~vue-fs-commons/app/assets/scss/frama/bootstrap4/badge'
;
@import
'~vue-fs-commons/app/assets/scss/frama/bootstrap4/buttons'
;
@import
'~vue-fs-commons/app/assets/scss/frama/bootstrap4/links'
;
@import
'~vue-fs-commons/app/assets/scss/frama/bootstrap4/type&code'
;
@import
'~vue-fs-commons/app/assets/scss/frama/bootstrap4/carousel'
;
#f-i18n
{
button
{
color
:
$secondary
;
fill
:
$secondary
;
border
:
none
;
&
:hover
{
color
:
$light
;
fill
:
$light
;
}
}
&
.show
button
{
color
:
$light
;
fill
:
$light
;
}
li
a
{
background
:
transparent
;
&
:hover
,
&
focus
{
background-color
:
$light
;
}
}
}
app/assets/scss/main.scss
View file @
7564433b
@import
'~vue-fs-commons/app/assets/scss/frama/colors'
;
/* Variables */
$bgcolor
:
#eee
;
$violet
:
#6a5687
;
$orange
:
#eb7239
;
$bleu
:
#0c5b7a
;
$rouge
:
#cc2d18
;
$vert
:
#8E9C48
;
$jaune
:
#C48A1B
;
$marron
:
#5d4037
;
/* Brown variant
$bsColor: (('f', 7), ('m', 7), ('m', 8), ('m', 2), ('b', 7), ('v', 6), ('o', 7), ('r', 8), ('d', 7));
$bgcolor: c(m, 3);
$secondary: bs(c, 2);
$dark: bs(c, 3);
$light: bs(c, 4);
*/
$ombre
:
0px
3px
4px
rgba
(
50
,
50
,
50
,
0
.2
);
$img-ombre
:
0px
2px
6px
rgba
(
50
,
50
,
50
,
0
.4
);
$carousel-ombre
:
0px
3px
3px
rgba
(
50
,
50
,
50
,
0
.5
);
$button-ombre
:
0px
1px
1px
rgba
(
50
,
50
,
50
,
0
.5
);
$primary
:
$violet
!
default
;
$secondary
:
#616161
!
default
;
$danger
:
$rouge
;
$warning
:
$orange
;
$info
:
$bleu
;
$success
:
$vert
;
/* Frameworks */
// @import 'frameworks/bootstrap3';
@import
'frameworks/bootstrap4'
;
/* Fonts */
@import
'fonts/fork-awesome'
;
@import
'fonts/dejavu-sans'
;
@import
'fonts/roboto'
;
/* Frama */
@import
'frama/bootstrap4'
;
@import
'~vuefs-commons/app/assets/scss/frama/common'
;
@import
'~vue
-
fs-commons/app/assets/scss/frama/common'
;
app/components/pages/Home.vue
View file @
7564433b
...
...
@@ -10,7 +10,7 @@
/>
</p>
<div
class=
"mx-5"
>
<div
class=
"mx-5
pt-3
"
>
<b-card
bg-variant=
"light"
>
<b-card-text>
<b-form>
...
...
@@ -37,9 +37,9 @@
variant=
"primary"
@
click=
"create"
>
<icon
name=
"th"
<svg-icon
:label=
"$t('public.create')"
name=
"th"
/>
</b-button>
</div>
...
...
@@ -64,9 +64,10 @@
<!-- Help -->
<div
class=
"col-md-4"
>
<h2
v-html=
"$t('help.title')"
></h2>
<icon
size=
"3x d-block text-center mb-3"
<svg-icon
name=
"question-circle"
size=
"3x"
variant=
"fc-g6 d-block text-center mb-3"
/>
<div
v-html=
"$t('help.md',
{ link: 'https://contact.framasoft.org/faq/#framacalc' })">
</div>
...
...
@@ -75,9 +76,10 @@
<!-- About software -->
<div
class=
"col-md-4"
>
<h2
v-html=
"$t('software.title')"
></h2>
<icon
size=
"3x d-block text-center mb-3"
<svg-icon
name=
"cloud"
size=
"3x"
variant=
"fc-g6 d-block text-center mb-3"
/>
<div
v-html=
"$t('software.md')"
>
...
...
@@ -87,9 +89,10 @@
<!-- Garden -->
<div
class=
"col-md-4"
>
<h2
v-html=
"$t('garden.title')"
></h2>
<icon
size=
"3x d-block text-center mb-3"
<svg-icon
name=
"leaf"
size=
"3x"
variant=
"fc-g6 d-block text-center mb-3"
/>
<div
v-html=
"$t('garden.md')"
></div>
...
...
app/components/partials/Header.vue
View file @
7564433b
<
template
>
<header
role=
"banner"
>
<div
class=
"
pull
-right"
>
<div
class=
"
float
-right"
>
<I18n
/>
</div>
<h1
class=
"sitename"
>
<h1>
<router-link
:to=
"`/$
{$t('lang')}/`"
class="text-decoration-none"
v-html="$t('color.calc')"
/>
</h1>
...
...
app/components/partials/I18n.vue
View file @
7564433b
<
template
>
<div
class=
"pull-right"
>
<b-dropdown
right
variant=
"outline-secondary"
:title=
"$t('nav.langChange', '-t')"
<b-dd
id=
"f-i18n"
ref=
"f-i18n"
right
variant=
"outline-secondary"
:title=
"$t('nav.langChange', '-t')"
>
<template
v-slot:button-content
>
<svg-icon
name=
"language"
size=
"lg"
:label=
"$t('nav.lang', '-t')"
sr-only
/>
</
template
>
<li
v-for=
"lang in locales.visible"
:key=
"lang"
>
<template
v-slot:button-content
>
<icon
name=
"language"
variant=
"fa-lg"
:label=
"$t('nav.lang')"
/>
</
template
>
<b-dropdown-item
v-for=
"lang in locales.visible"
:key=
"lang"
<b-link
:to=
"`/${lang}/${($route.path.split('/')[2] || '')}`"
@
click=
"changeLanguage(lang)"
>
{{ locales[lang] }}
</b-dropdown-item>
<b-dropdown-divider
v-if=
"$te('meta.i18n')"
/>
<b-dropdown-item
v-if=
"$te('meta.i18n')"
class=
"dropdown-item"
@
click.native=
"changeLanguage(lang)"
v-text=
"locales[lang]"
/>
</li>
<b-dd-divider
v-if=
"$te('meta.i18n')"
/>
<li
v-if=
"$te('meta.i18n')"
>
<a
:href=
"$t('meta.i18n')"
class=
"dropdown-item"
>
<icon
<
svg-
icon
name=
"plus"
:label=
"$t('nav.translate')"
/>
</
b-dropdown-item
>
</
b-dropdown
>
</
div
>
</
a
>
</
li
>
</
b-dd
>
</template>
<
script
>
...
...
@@ -48,6 +54,7 @@ export default {
this
.
switchLanguage
=
lang
;
this
.
$i18n
.
locale
=
lang
;
[
this
.
currentComponent
]
=
[
this
.
$route
.
path
.
split
(
'
/
'
)[
2
]];
this
.
$refs
[
'
f-i18n
'
].
hide
(
true
);
},
},
};
...
...
app/data/project.yml
View file @
7564433b
commons
:
-
color
-
svg
-
link
-
emoji
-
soft
...
...
app/index.js
View file @
7564433b
...
...
@@ -3,14 +3,12 @@ import VueRouter from 'vue-router';
import
VueI18n
from
'
vue-i18n
'
;
import
vueHeadful
from
'
vue-headful
'
;
import
BootstrapVue
from
'
bootstrap-vue
'
;
import
marked
from
'
marked
'
;
import
deburr
from
'
lodash/deburr
'
;
import
is
from
'
vuefs-commons/app/plugins/is
'
;
import
cookie
from
'
vuefs-commons/app/plugins/cookie
'
;
import
merge
from
'
vuefs-commons/app/plugins/merge
'
;
import
icon
from
'
vuefs-commons/app/components/commons/Icon.vue
'
;
import
is
from
'
vue-fs-commons/app/plugins/is
'
;
import
cookie
from
'
vue-fs-commons/app/plugins/cookie
'
;
import
merge
from
'
vue-fs-commons/app/plugins/merge
'
;
import
text
from
'
vue-fs-commons/app/plugins/text
'
;
import
SVGIcon
from
'
vue-fs-commons/app/components/commons/SVGIcon.vue
'
;
import
App
from
'
./App.vue
'
;
import
'
./assets/scss/main.scss
'
;
...
...
@@ -23,7 +21,8 @@ Vue.component('vue-headful', vueHeadful);
Vue
.
use
(
is
);
Vue
.
use
(
cookie
);
Vue
.
use
(
merge
);
Vue
.
component
(
'
icon
'
,
icon
);
Vue
.
use
(
text
);
Vue
.
component
(
'
svg-icon
'
,
SVGIcon
);
const
defaultLocale
=
'
fr
'
;
const
locales
=
{};
...
...
@@ -51,13 +50,14 @@ req.keys().forEach((key) => {
});
// Import commons data list
req
=
require
.
context
(
'
../node_modules/vuefs-commons/app/data/commons/
'
,
false
,
/
\.
yml$/
);
req
=
require
.
context
(
'
../node_modules/vue
-
fs-commons/app/data/commons/
'
,
false
,
/
\.
yml$/
);
req
.
keys
().
forEach
((
key
)
=>
{
commons
.
push
(
key
.
replace
(
/
\.\/(
.*
)\.
yml/
,
'
$1
'
));
});
const
lang
=
window
.
location
.
href
.
split
(
'
/
'
)[(
process
.
env
.
BASE_URL
===
''
||
(
window
.
location
.
href
.
match
(
/
\/
/g
)).
length
===
3
)
?
3
:
4
]
.
replace
(
`
${
window
.
location
.
host
}
/
${
process
.
env
.
BASE_URL
}
`
,
''
)
.
split
(
'
/
'
)[(
process
.
env
.
BASE_URL
===
''
)
?
2
:
3
]
.
substr
(
0
,
2
)
.
toLowerCase
()
||
''
;
document
.
getElementsByTagName
(
'
html
'
)[
0
].
setAttribute
(
'
lang
'
,
lang
);
...
...
@@ -67,7 +67,7 @@ let defaultRouteLang = '';
const
messages
=
{};
const
numberFormats
=
{};
messages
.
locales
=
require
(
'
../node_modules/vuefs-commons/app/locales/lang.yml
'
);
// eslint-disable-line
messages
.
locales
=
require
(
'
../node_modules/vue
-
fs-commons/app/locales/lang.yml
'
);
// eslint-disable-line
messages
.
locales
.
available
=
Object
.
keys
(
messages
.
locales
)
.
filter
(
n
=>
Object
.
keys
(
locales
).
includes
(
n
)
...
...
@@ -85,7 +85,7 @@ if (Array.isArray(project.commons) && project.commons.length > 0) {
[
commons
]
=
[
project
.
commons
];
}
for
(
let
i
=
0
;
i
<
commons
.
length
;
i
+=
1
)
{
req
=
require
(
`../node_modules/vuefs-commons/app/data/commons/
${
commons
[
i
]}
.yml`
)
||
{};
// eslint-disable-line
req
=
require
(
`../node_modules/vue
-
fs-commons/app/data/commons/
${
commons
[
i
]}
.yml`
)
||
{};
// eslint-disable-line
data
[
commons
[
i
]]
=
merge
.
$
(
data
[
commons
[
i
]],
JSON
.
parse
(
JSON
.
stringify
(
req
)));
}
data
=
merge
.
$
(
data
,
JSON
.
parse
(
JSON
.
stringify
(
project
)));
...
...
@@ -113,6 +113,8 @@ if (process.env.NODE_ENV === 'production'
const
routes
=
[];
let
msg
=
{};
messages
.
locales
.
map
=
{};
// Import locales
messages
.
locales
.
available
.
forEach
((
k
)
=>
{
/* eslint-disable */
...
...
@@ -128,35 +130,54 @@ messages.locales.available.forEach((k) => {
};
// Import data
msg
=
{
txt
:
{},
html
:
{}};
msg
=
{
txt
:
{},
html
:
{},
tmp
:
{}};
msg
=
merge
.
$
(
msg
,
JSON
.
parse
(
JSON
.
stringify
(
data
)));
const
mainFile
=
locales
[
k
].
filter
(
filename
=>
/^_
?
main$/
.
test
(
filename
));
if
(
mainFile
.
length
>
0
)
{
// Init with ../node_modules/vuefs-commons/app/locales/lg/_commons.yml
req
=
require
(
`../node_modules/vuefs-commons/app/locales/
${
k
}
/_commons.yml`
)
||
{};
msg
=
merge
.
$
(
msg
,
JSON
.
parse
(
JSON
.
stringify
(
req
)));
// Init with ../node_modules/vue
-
fs-commons/app/locales/lg/_commons.yml
req
=
require
(
`../node_modules/vue
-
fs-commons/app/locales/
${
k
}
/_commons.yml`
)
||
{};
msg
.
tmp
=
merge
.
$
(
msg
.
tmp
,
JSON
.
parse
(
JSON
.
stringify
(
req
)));
// then import locales/lg/_main.yml (active and visible)
// or locales/lg/main.yml (active and hidden)
req
=
require
(
`./locales/
${
k
}
/
${
mainFile
[
0
]}
.yml`
)
||
{};
msg
=
merge
.
$
(
msg
,
JSON
.
parse
(
JSON
.
stringify
(
req
)));
msg
.
tmp
=
merge
.
$
(
msg
.
tmp
,
JSON
.
parse
(
JSON
.
stringify
(
req
)));
}
// locales/lg/*.yml
for
(
let
i
=
0
;
i
<
locales
[
k
].
length
;
i
+=
1
)
{
const
file
=
locales
[
k
][
i
];
if
(
!
/^_
?
main$/
.
test
(
file
))
{
msg
[
file
]
=
msg
[
file
]
||
{};
msg
.
tmp
[
file
]
=
msg
.
tmp
[
file
]
||
{};
req
=
require
(
`./locales/
${
k
}
/
${
file
}
.yml`
)
||
{};
msg
[
file
]
=
merge
.
$
(
msg
[
file
],
JSON
.
parse
(
JSON
.
stringify
(
req
)));
msg
.
tmp
[
file
]
=
merge
.
$
(
msg
.
tmp
[
file
],
JSON
.
parse
(
JSON
.
stringify
(
req
)));
}
}
msg
=
merge
.
$
(
msg
,
msg
.
tmp
);
// Create locale template to be able to use the English text
// instead of the yaml key for translation
if
(
k
===
'
en
'
)
{
Object
.
assign
(
messages
.
locales
.
map
,
...
function
_flatten
(
o
,
k
)
{
return
[].
concat
(...
Object
.
keys
(
o
)
.
map
(
i
=>
{
const
tmp
=
k
?
`
${
k
}
.
${
i
}
`
:
i
;
return
typeof
o
[
i
]
!==
'
object
'
?
({[
JSON
.
stringify
(
o
[
i
].
trim
().
replace
(
/
\n[
]
+/g
,
'
\n
'
))]:
`@:
${
tmp
}
`
})
:
_flatten
(
o
[
i
],
tmp
);
}
)
);
}(
msg
.
tmp
)
);
}
delete
msg
.
tmp
;
Object
.
keys
(
msg
.
color
).
forEach
((
j
)
=>
{
if
(
msg
.
txt
[
j
]
===
undefined
)
{
const
tmp
=
document
.
createElement
(
'
div
'
);
tmp
.
innerHTML
=
msg
.
color
[
j
];
msg
.
txt
[
j
]
=
tmp
.
textContent
||
tmp
.
innerText
;
msg
.
txt
[
j
]
=
text
.
textTransform
(
msg
.
color
[
j
],
'
-t
'
);
}
});
Object
.
keys
(
msg
.
link
).
forEach
((
j
)
=>
{
...
...
@@ -206,6 +227,8 @@ for (let i = 0; i < pages.length; i += 1) {
});
}
}
messages
.
routes
=
routes
;
messages
.
base
=
`
${
__dirname
}${
process
.
env
.
BASE_URL
}
`
;
// Create VueI18n instance with options
const
i18n
=
new
VueI18n
({
...
...
@@ -217,109 +240,7 @@ const i18n = new VueI18n({
});
// Override $t() for markdown and formatting
Vue
.
prototype
.
$t
=
(
key
,
locale
,
values
)
=>
{
let
translated
=
''
;
let
trueLocale
=
''
;
let
options
=
''
;
if
(
typeof
locale
===
'
string
'
)
{
// Split locale and options
if
(
i18n
.
messages
.
locales
.
available
.
indexOf
(
locale
.
split
(
'
'
)[
0
])
>
0
)
{
// locale = 'en_GB -t', 'fr_FR latin'…
[
trueLocale
]
=
[
locale
.
split
(
'
'
)[
0
]];
options
=
locale
.
substring
(
locale
.
indexOf
(
'
'
)
+
1
);
}
else
{
// locale = '-t', 'latin'…
trueLocale
=
i18n
.
locale
;
options
=
locale
;
}
if
(
/^-.*
?
k.*
?
$/
.
test
(
options
))
{
// -k means we only want to keep the key or text/html to format
translated
=
key
;
}
else
{
// we want to format the translation
translated
=
i18n
.
t
(
key
,
trueLocale
,
values
);
}
}
else
{
// "locale" is missing so, in fact, it is a "value"
translated
=
(
Array
.
isArray
(
values
)
||
typeof
values
===
'
object
'
)
?
i18n
.
t
(
key
,
undefined
,
values
)
:
i18n
.
t
(
key
,
undefined
,
locale
);
}
let
formatted
=
typeof
translated
===
'
string
'
?
translated
// Translate :emoji:
.
replace
(
/:
((?!
.*--.*|.*__.*
)[
a-z0-9_-
]
+
?)
:/g
,
(
c
,
$1
)
=>
{
if
(
i18n
.
te
(
`emoji['
${
$1
}
']`
))
{
return
i18n
.
t
(
`emoji['
${
$1
}
']`
);
}
return
`:
${
$1
}
:`
;
})
// Translate linked @:key or @:(key)
// (cf linkKeyMatcher in vue-i18n/src/index.js)
.
replace
(
/@:
\(?([\w\-
_|.
]
+
[\w\-
_|
]
+
)\)?
/g
,
(
c
,
$1
)
=>
i18n
.
t
(
$1
))
// Line break for md (maybe not very useful)
.
replace
(
/
\n
/g
,
'
\n
'
)
// eslint-disable-line no-irregular-whitespace
.
replace
(
`
${
data
.
baseurl
}
/`
,
data
.
baseurl
)
:
translated
;
// Convert to Markdown
if
(
typeof
formatted
===
'
string
'
&&
!
/^https
?
:
\/\/
/
.
test
(
formatted
))
{
formatted
=
(
/
\n\n
/
.
test
(
formatted
))
?
marked
(
formatted
)
// marked convert single string to paragraphs
// or to ordered list
// so cleaning is needed
:
marked
(
formatted
)
.
replace
(
/^<p>
(
.*
?)
<
\/
p>
\n?
$/
sm
,
'
$1
'
)
.
replace
(
/^<ol
(
.*
?)
>
\n
<li>
(
.*
?)
<
\/
li>
\n
<
\/
ol>
\n?
$/
sm
,
(
c
,
$1
,
$2
)
=>
`
${
$1
?
$1
.
replace
(
/
[^
0-9
]
/g
,
''
)
:
'
1
'
}
.
${
$2
}
`
);
}
// Formatting options
if
(
options
!==
''
)
{
// -t or text (html cleanup)
if
(
/text/
.
test
(
options
)
||
/^-.*
?
t.*
?
$/
.
test
(
options
))
{
const
tmp
=
new
DOMParser
().
parseFromString
(
formatted
,
'
text/html
'
);
formatted
=
tmp
.
body
.
textContent
||
''
;
}
// -L or latin (remove diacritics)
if
(
/latin/
.
test
(
options
)
||
/^-.*
?
L.*
?
$/
.
test
(
options
))
{
formatted
=
deburr
(
formatted
);
}
// -l (lowercase)
if
(
/^-.*
?
l.*
?
$/
.
test
(
options
))
{
formatted
=
formatted
.
toLowerCase
();
}
// -U (uppercase)
if
(
/^-.*
?
U.*
?
$/
.
test
(
options
))
{
formatted
=
formatted
.
toUpperCase
();
}
// -K (capitalize)
if
(
/^-.*
?
K.*
?
$/
.
test
(
options
))
{
formatted
=
formatted
.
replace
(
/^./
,
v
=>
v
.
toUpperCase
());
}
if
(
/sanitize/
.
test
(
options
)
||
/^-.*
?
@.*
?
$/
.
test
(
options
))
{
formatted
=
formatted
.
toLowerCase
().
trim
()
.
replace
(
/@:
[
.a-z
]
+ /g
,
''
)
// remove vue-i18n var
.
replace
(
/
[
'’
]
/g
,
'
-
'
)
.
replace
(
/
[^
a-zA-Z0-9-_.
]
/g
,
''
);
}
if
(
/noframa/
.
test
(
options
)
||
/^-.*
?
~.*
?
$/
.
test
(
options
))
{
formatted
=
formatted
.
replace
(
'
framand
'
,
'
and
'
)
.
replace
(
'
framage
'
,
'
age
'
)
.
replace
(
'
framae
'
,
'
mae
'
)
.
replace
(
'
framin
'
,
'
min
'
)