Date: Monday, March 17, 2014 @ 19:09:56 Author: bpiotrowski Revision: 107531
Use associative arrays to store available languages. Modified: gimp-help/trunk/PKGBUILD ----------+ PKGBUILD | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2014-03-17 18:00:50 UTC (rev 107530) +++ PKGBUILD 2014-03-17 18:09:56 UTC (rev 107531) @@ -13,29 +13,30 @@ source=(ftp://ftp.gimp.org/pub/gimp/help/gimp-help-$pkgver.tar.bz2) md5sums=('7f48c64bcadab9611ce8d3d89d990bb4') +declare -A _languages _languages=( - 'ca "Catalan"' - 'da "Danish"' - 'de "German"' - 'el "Greek"' - 'en "English"' - 'en_GB "English (United Kingdom)"' - 'es "Spanish"' - 'fr "French"' - 'it "Italian"' - 'ja "Japanese"' - 'ko "Korean"' - 'nl "Dutch"' - 'nn "Norwegian "' - 'pt_BR "Brazilian Portuguese"' - 'ru "Russian"' - 'sl "Slovenian"' - 'sv "Swedish"' - 'zh_CN "Chinese (simplified)"' + [ca]='Catalan' + [da]='Danish' + [de]='German' + [el]='Greek' + [en]='English' + [en_GB]='English (United Kingdom)' + [es]='Spanish' + [fr]='French' + [it]='Italian' + [ja]='Japanese' + [ko]='Korean' + [nl]='Dutch' + [nn]='Norwegian' + [pt_BR]='Brazilian Portuguese' + [ru]='Russian' + [sl]='Slovenian' + [sv]='Swedish' + [zh_CN]='Chinese (simplified)' ) _package() { - pkgdesc="$2 help files for Gimp" + pkgdesc="${_languages[$1]} help files for Gimp" install -dm755 "$pkgdir"/usr/share/gimp/2.0/help/$1 cp -rL "$srcdir"/$pkgbase-$pkgver/html/$1 \ "$pkgdir"/usr/share/gimp/2.0/help @@ -52,12 +53,11 @@ make } -for _lang in "${_languages[@]}"; do - _locale=${_lang%% *} - _pkgname=gimp-help-${_locale,,} +for lang in ${!_languages[@]}; do + _pkgname=gimp-help-$lang pkgname+=($_pkgname) eval "package_$_pkgname() { - _package $_lang + _package $lang }" done