Merge pull request #18819 from MauricioFauth/trans-files

Move po and locale directories to resources
This commit is contained in:
Maurício Meneghini Fauth 2023-11-30 16:49:12 -03:00 committed by GitHub
commit ad68d18c3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
108 changed files with 34 additions and 33 deletions

1
.gitignore vendored
View File

@ -29,6 +29,7 @@ web.config
.htaccess
# Locales
/locale/
/resources/locale/
# Temporary files to generate locales for Twig
/twig-templates/
# Backups

View File

@ -63,7 +63,7 @@ return [
/**
* Path to files with compiled locales (*.mo)
*/
'localePath' => ROOT_PATH . 'locale' . DIRECTORY_SEPARATOR,
'localePath' => ROOT_PATH . 'resources' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR,
/**
* Define the cache directory for routing cache and other cache files

View File

@ -13,22 +13,22 @@ else
fi
compile() {
lang=$(echo "$1" | sed 's@po/\(.*\)\.po@\1@')
lang=$(echo "$1" | sed 's@resources/po/\(.*\)\.po@\1@')
if [ -n "$stats" ] ; then
printf "%s: " "$lang"
fi
mkdir -p locale/"$lang"/LC_MESSAGES
msgfmt $stats --check -o locale/"$lang"/LC_MESSAGES/phpmyadmin.mo "$1"
mkdir -p resources/locale/"$lang"/LC_MESSAGES
msgfmt $stats --check -o resources/locale/"$lang"/LC_MESSAGES/phpmyadmin.mo "$1"
return $?
}
if [ -n "$1" ] ; then
compile po/"$1".po
compile resources/po/"$1".po
exit $?
fi
result=0
for x in po/*.po ; do
for x in resources/po/*.po ; do
compile "$x"
ret=$?
if [ $ret != 0 ] ; then

View File

@ -72,7 +72,7 @@ validateExtension() {
foundFileExt
fi
;;
locale/*)
resources/locale/*)
if [ "${extension}" != "mo" ]; then
foundFileExt
fi

View File

@ -465,7 +465,7 @@ LC_ALL=C make -C doc html
find doc -name '*.pyc' -print0 | xargs -0 -r rm -f
# Check for gettext support
if [ -d po ] ; then
if [ -d resources/po ] ; then
echo "* Generating mo files"
./bin/generate-mo
if [ -f ./bin/remove-incomplete-mo ] ; then
@ -612,7 +612,7 @@ for kit in $KITS ; do
rm phpunit.xml.*
rm .editorconfig .browserslistrc .eslintignore .jshintrc .eslintrc.json .stylelintrc.json psalm.xml psalm-baseline.xml phpstan.neon.dist phpstan-baseline.neon phpcs.xml.dist jest.config.cjs infection.json5.dist
# Gettext po files (if they were not removed by ./bin/internal/lang-cleanup.sh)
rm -rf po
rm -rf resources/po
# Documentation source code
mv doc/html htmldoc
rm -r doc

View File

@ -30,23 +30,23 @@ for type in "$@" ; do
exit 0
;;
english)
rm -rf po
rm -rf locale
rm -rf resources/po
rm -rf resources/locale
rm -rf vendor/phpmyadmin/sql-parser/locale
exit 0
;;
*)
match="$match -and -not -name $type.po -and -not -path locale/$type/LC_MESSAGES/phpmyadmin.mo -and -not -path vendor/phpmyadmin/sql-parser/locale/$type/LC_MESSAGES/sqlparser.mo"
match="$match -and -not -name $type.po -and -not -path resources/locale/$type/LC_MESSAGES/phpmyadmin.mo -and -not -path vendor/phpmyadmin/sql-parser/locale/$type/LC_MESSAGES/sqlparser.mo"
;;
esac
done
# Delete unwanted languages
# shellcheck disable=SC2086
find po locale vendor/phpmyadmin/sql-parser/locale -type f $match -print0 | xargs -0r rm
find resources/po resources/locale vendor/phpmyadmin/sql-parser/locale -type f $match -print0 | xargs -0r rm
# Delete empty directories
rmdir --ignore-fail-on-non-empty locale/*/*
rmdir --ignore-fail-on-non-empty locale/*
rmdir --ignore-fail-on-non-empty resources/locale/*/*
rmdir --ignore-fail-on-non-empty resources/locale/*
rmdir --ignore-fail-on-non-empty vendor/phpmyadmin/sql-parser/locale/*/*
rmdir --ignore-fail-on-non-empty vendor/phpmyadmin/sql-parser/locale/*

View File

@ -5,7 +5,7 @@ if [ -n "$GATEWAY_INTERFACE" ] ; then
exit 1
fi
for x in po/*.po ; do
for x in resources/po/*.po ; do
grep 'Team' "$x" | sed 's/.*: \(.*\)<.*/\1/'
git shortlog -sne --no-merges -- "$x" | grep '^ [ 0-9][0-9]\{3\}'
done

View File

@ -38,7 +38,7 @@ fi
check() {
TMPOUTPUTFILE=$2
lang=$(echo "$1" | sed 's@po/\(.*\)\.po@\1@')
lang=$(echo "$1" | sed 's@resources/po/\(.*\)\.po@\1@')
STATS=$(LC_ALL=C msgfmt --statistics -o /dev/null "$1" 2>&1)
if echo "$STATS" | grep -q ' translated ' ; then
TRANSLATED=$(echo "$STATS" | sed 's/\(^\|.* \)\([0-9]*\) translated.*/\2/')
@ -60,13 +60,13 @@ check() {
if [ "$PERCENT" -lt "$THRESHOLD" ] ; then
echo "Removing $lang, only $PERCENT%"
rm -f locale/"$lang"/LC_MESSAGES/phpmyadmin.mo
rmdir locale/"$lang"/LC_MESSAGES
rmdir locale/"$lang"
rm -f resources/locale/"$lang"/LC_MESSAGES/phpmyadmin.mo
rmdir resources/locale/"$lang"/LC_MESSAGES
rmdir resources/locale/"$lang"
fi
}
for x in po/*.po ; do
for x in resources/po/*.po ; do
check "$x" "$TMPOUTPUTFILE"
done

View File

@ -16,9 +16,9 @@ rm -rf twig-templates/
php bin/console cache:warmup --twig-po --env development
# Update pot (template), ensure that advisor is at the end
LOCS=$(find po -name '*.po' | sed 's@.*/\(.*\)\.po@\1@')
LOCS=$(find resources/po -name '*.po' | sed 's@.*/\(.*\)\.po@\1@')
find . -name '*.php' -not -path './tests/*' -not -path './po/*' -not -path './tmp/*' -not -path './release/*' -not -path './node_modules/*' -not -path './vendor/*' > twig-templates/filesList
find . -name '*.php' -not -path './tests/*' -not -path './resources/po/*' -not -path './tmp/*' -not -path './release/*' -not -path './node_modules/*' -not -path './vendor/*' > twig-templates/filesList
php ./bin/match-twig-cache
sort --dictionary-order --ignore-case --output ./twig-templates/filesListTemp < ./twig-templates/filesList
@ -30,7 +30,7 @@ php ./bin/match-twig-cache --reverse
xgettext \
-d phpmyadmin \
--msgid-bugs-address=translators@phpmyadmin.net \
-o po/phpmyadmin.pot \
-o resources/po/phpmyadmin.pot \
--language=PHP \
--add-comments=l10n \
--add-location \
@ -58,7 +58,7 @@ sed -i.~ '
s/PACKAGE/phpMyAdmin/;
s/(C) YEAR/(C) 2003 - '"$(date +%Y)"'/;
s/VERSION/'"$ver"'/;
' po/phpmyadmin.pot
' resources/po/phpmyadmin.pot
# Update po files (translations)
for loc in $LOCS ; do
@ -68,12 +68,12 @@ for loc in $LOCS ; do
s/(C) YEAR/(C) 2003 - '"$(date +%Y)"'/;
s/VERSION/'"$ver"'/;
s/Project-Id-Version: phpMyAdmin .*/Project-Id-Version: phpMyAdmin '"$ver"'\\n"/;
' po/"$loc".po
msgmerge --previous -U po/"$loc".po po/phpmyadmin.pot
' resources/po/"$loc".po
msgmerge --previous -U resources/po/"$loc".po resources/po/phpmyadmin.pot
done
# Commit changes
git add po/*.po po/phpmyadmin.pot
git add resources/po/*.po resources/po/phpmyadmin.pot
git commit -s -m 'Update po files
[ci skip]'

View File

@ -108,7 +108,7 @@ $cfg['SaveDir'] = '';
/**
* Default language to use, if not browser-defined or user-defined
* (you find all languages in the locale folder)
* (you find all languages in the 'resources/locale' folder)
* uncomment the desired line:
* default = 'en'
*/

View File

@ -2961,7 +2961,7 @@ Languages
Defines the default language to use, if not browser-defined or user-
defined. The corresponding language file needs to be in
locale/*code*/LC\_MESSAGES/phpmyadmin.mo.
resources/locale/*code*/LC\_MESSAGES/phpmyadmin.mo.
.. config:option:: $cfg['DefaultConnectionCollation']
@ -2979,7 +2979,7 @@ Languages
:default: not set
Force language to use. The corresponding language file needs to be in
locale/*code*/LC\_MESSAGES/phpmyadmin.mo.
resources/locale/*code*/LC\_MESSAGES/phpmyadmin.mo.
.. config:option:: $cfg['FilterLanguages']

View File

@ -687,7 +687,7 @@ Some users have requested to be able to reduce the size of the phpMyAdmin instal
This is not recommended and could lead to confusion over missing features, but can be done.
A list of files and corresponding functionality which degrade gracefully when removed include:
* :file:`./locale/` folder, or unused subfolders (interface translations)
* :file:`./resources/locale/` folder, or unused subfolders (interface translations)
* Any unused themes in :file:`./public/themes/` except the default theme `pmahomme`.
* :file:`./app/language_stats.inc.php` (translation statistics)
* :file:`./doc/` (documentation)

Some files were not shown because too many files have changed in this diff Show More