kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
				
				
				
			Make scripts more portable
							rodzic
							
								
									5fded7a701
								
							
						
					
					
						commit
						39405bbc3e
					
				|  | @ -0,0 +1 @@ | ||||||
|  | Frontend build tooling is less dependent on `npm` or `yarn` being used (!1285) | ||||||
|  | @ -1,4 +1,6 @@ | ||||||
| #!/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 | find node_modules/fomantic-ui-css/components -name "*.min.css" -delete | ||||||
| mkdir -p node_modules/fomantic-ui-css/tweaked | mkdir -p node_modules/fomantic-ui-css/tweaked | ||||||
|  |  | ||||||
|  | @ -1,9 +1,13 @@ | ||||||
| #!/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) | 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 | mkdir -p src/translations | ||||||
| 
 | 
 | ||||||
| for locale in $locales; do | 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 | 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 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,8 @@ | ||||||
| #!/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=$(tail -n +2 src/locales.js | sed -e 's/export default //' | jq '.locales[].code' | xargs echo) | ||||||
| locales_dir="locales" | locales_dir="locales" | ||||||
| sources=$(find src -name '*.vue' -o -name '*.html' 2> /dev/null) | sources=$(find src -name '*.vue' -o -name '*.html' 2> /dev/null) | ||||||
|  | @ -7,7 +11,7 @@ touch $locales_dir/app.pot | ||||||
| GENERATE=${GENERATE-true} | GENERATE=${GENERATE-true} | ||||||
| # Create a main .pot template, then generate .po files for each available language. | # 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. | # 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 \ | xgettext --language=JavaScript --keyword=npgettext:1c,2,3 \ | ||||||
|     --from-code=utf-8 --join-existing --no-wrap \ |     --from-code=utf-8 --join-existing --no-wrap \ | ||||||
|     --package-name=$(node -e "console.log(require('./package.json').name);") \ |     --package-name=$(node -e "console.log(require('./package.json').name);") \ | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| #!/bin/bash -eu | #!/usr/bin/env -S bash -eux | ||||||
| 
 | 
 | ||||||
| # Typical use: | # Typical use: | ||||||
| # cp -r locales old_locales | # cp -r locales old_locales | ||||||
|  | @ -6,6 +6,8 @@ | ||||||
| # ./scripts/i18n-populate-contextualized-strings.sh old_locales locales | # ./scripts/i18n-populate-contextualized-strings.sh old_locales locales | ||||||
| # Then review/commit the changes | # Then review/commit the changes | ||||||
| 
 | 
 | ||||||
|  | cd "$(dirname $0)/.." # change into base directory | ||||||
|  | 
 | ||||||
| old_locales_dir=$1 | old_locales_dir=$1 | ||||||
| new_locales_dir=$2 | new_locales_dir=$2 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| #!/bin/bash -eux | #!/usr/bin/env -S bash -eux | ||||||
| integration_branch="translations-integration" | integration_branch="translations-integration" | ||||||
| git remote add weblate https://translate.funkwhale.audio/git/funkwhale/front/ || echo "remote already exists" | git remote add weblate https://translate.funkwhale.audio/git/funkwhale/front/ || echo "remote already exists" | ||||||
| git fetch weblate | git fetch weblate | ||||||
|  |  | ||||||
|  | @ -0,0 +1,5 @@ | ||||||
|  | #!/usr/bin/env bash -S -eux | ||||||
|  | 
 | ||||||
|  | npm_binaries () { | ||||||
|  |   command -v yarn > /dev/null && yarn bin || npm bin | ||||||
|  | } | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 heyarne
						heyarne