Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
vachan-maker
funkwhale
Commits
39405bbc
Commit
39405bbc
authored
Apr 07, 2021
by
heyarne
Committed by
Georg Krause
Apr 07, 2021
Browse files
Make scripts more portable
parent
5fded7a7
Changes
7
Hide whitespace changes
Inline
Side-by-side
changes/changelog.d/1285.bugfix
0 → 100644
View file @
39405bbc
Frontend build tooling is less dependent on `npm` or `yarn` being used (!1285)
front/scripts/fix-fomantic-css.sh
View file @
39405bbc
#!/bin/bash -eux
#!/usr/bin/env -S bash -eux
cd
"
$(
dirname
$0
)
/.."
# change into base directory
find node_modules/fomantic-ui-css/components
-name
"*.min.css"
-delete
mkdir
-p
node_modules/fomantic-ui-css/tweaked
...
...
front/scripts/i18n-compile.sh
View file @
39405bbc
#!/bin/bash -eux
#!/usr/bin/env -S bash -eux
cd
"
$(
dirname
$0
)
/.."
# change into base directory
source
scripts/utils.sh
locales
=
$(
tail
-n
+2 src/locales.js |
sed
-e
's/export default //'
| jq
'.locales[].code'
|
grep
-v
'en_US'
| xargs
echo
)
mkdir
-p
src/translations
for
locale
in
$locales
;
do
$(
yarn bin
)
/gettext-compile locales/
$locale
/LC_MESSAGES/app.po
--output
src/translations/
$locale
.json
$(
npm_binaries
)
/gettext-compile locales/
$locale
/LC_MESSAGES/app.po
--output
src/translations/
$locale
.json
done
# find locales -name '*.po' | xargs $(
yarn
bin
)
/gettext-compile --output src/translations.json
# find locales -name '*.po' | xargs $(
npm_binaries)/.
bin/gettext-compile --output src/translations.json
front/scripts/i18n-extract.sh
View file @
39405bbc
#!/bin/bash -eux
#!/usr/bin/env -S bash -eux
cd
"
$(
dirname
$0
)
/.."
# change into base directory
source
scripts/utils.sh
locales
=
$(
tail
-n
+2 src/locales.js |
sed
-e
's/export default //'
| jq
'.locales[].code'
| xargs
echo
)
locales_dir
=
"locales"
sources
=
$(
find src
-name
'*.vue'
-o
-name
'*.html'
2> /dev/null
)
...
...
@@ -7,7 +11,7 @@ touch $locales_dir/app.pot
GENERATE
=
${
GENERATE
-true
}
# Create a main .pot template, then generate .po files for each available language.
# Extract gettext strings from templates files and create a POT dictionary template.
$(
yarn bin
)
/gettext-extract
--attribute
v-translate
--quiet
--output
$locales_dir
/app.pot
$sources
$(
npm_binaries
)
/gettext-extract
--attribute
v-translate
--quiet
--output
$locales_dir
/app.pot
$sources
xgettext
--language
=
JavaScript
--keyword
=
npgettext:1c,2,3
\
--from-code
=
utf-8
--join-existing
--no-wrap
\
--package-name
=
$(
node
-e
"console.log(require('./package.json').name);"
)
\
...
...
front/scripts/i18n-populate-contextualized-strings.sh
View file @
39405bbc
#!/
bin/
bash -eu
#!/
usr/bin/env -S
bash -eu
x
# Typical use:
# cp -r locales old_locales
...
...
@@ -6,6 +6,8 @@
# ./scripts/i18n-populate-contextualized-strings.sh old_locales locales
# Then review/commit the changes
cd
"
$(
dirname
$0
)
/.."
# change into base directory
old_locales_dir
=
$1
new_locales_dir
=
$2
...
...
front/scripts/i18n-weblate-to-origin.sh
View file @
39405bbc
#!/
bin/
bash -eux
#!/
usr/bin/env -S
bash -eux
integration_branch
=
"translations-integration"
git remote add weblate https://translate.funkwhale.audio/git/funkwhale/front/
||
echo
"remote already exists"
git fetch weblate
...
...
front/scripts/utils.sh
0 → 100644
View file @
39405bbc
#!/usr/bin/env bash -S -eux
npm_binaries
()
{
command
-v
yarn
>
/dev/null
&&
yarn bin
||
npm bin
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment