# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
# Contributor: fauno <fauno@kiwwwi.com.ar>
# Contributor: Figue <ffigue@gmail.com>
# Based on icecat-i18n package, which is in turn based on firefox-i18n

# When updating to a newer upstream release:
# - Edit variables in in Makefile.
# - (optionally) edit PKGBUILD.in
# - Run 'make'. It will take care of everything else for you.

_debname=iceweasel
_debver=11.0
_debrel=2
_debrepo=http://ftp.debian.org/debian/pool/main/
debfile() { echo $@|sed -r 's@(.).*@\1/&/&@'; }

_langpacks=(af ak ar as ast be bg bn-BD bn-IN br bs ca csb cs cy da de el en-GB en-ZA eo es-AR es-CL es-ES es-MX et eu fa fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hu hy-AM id is it ja kk kn ko ku lg lt lv mai mk ml mr nb-NO nl nn-NO nso or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta ta-LK te th tr uk vi zh-CN zh-TW zu)

pkgbase=iceweasel-i18n
pkgname=($(for lang in ${_langpacks[@]}
        do echo $pkgbase-$lang | tr A-Z a-z
        done))
_pkgver=10.0
pkgver=${_debver}.${_debrel}
pkgrel=1

pkgdesc="Language packs for Debian Iceweasel."
arch=('any')
url="http://www.geticeweasel.org/"
license=('MPL')
depends=("iceweasel-libre>=$_pkgver")
source=()
for lang in ${_langpacks[@]}
do
    source+=("${_debrepo}/`debfile ${_debname}`-l10n-$(echo $lang | tr A-Z a-z)_${_debver}-${_debrel}_all.deb")
done

build() {
  cd "${srcdir}"
  for f in *.deb
  do
      bsdtar xf $f
      bsdtar xf data.tar.gz
  done
}

_path="/usr/lib/iceweasel/extensions"


for lang in ${_langpacks[@]}
do
    eval "
package_iceweasel-i18n-$(echo $lang | tr A-Z a-z)() {
  install -Dm644 \"\$srcdir$_path/langpack-$lang@iceweasel.mozilla.org.xpi\" \"\$pkgdir$_path/langpack-$lang@iceweasel.mozilla.org.xpi\"
}
"
done

md5sums=('c11d65787c3f2848e0b582115e50c3ca'
         'f579bb571a43c33d6a13fd71f7853331'
         '5ec94ba1055f11e8a33674a3ea623fca'
         '7598e4409463c98c6f358a49c0e0e864'
         'f3a7156974b43a7829e68e82e6dd749a'
         '2cd6d08c82a59cee5454d3da763d9808'
         '3b5529e7d1a6c87e9a99b251bb008b9f'
         'f1eb67cbc423a49dd4b4f85e1f50034c'
         '76c39cc1134b4074283fe080a1d0b29e'
         '1b282bba90202701fa63fc21b44e78d5'
         '77f818359b98fdd2a23b40989f9f56c6'
         'cbd8fb3d20a5269ac728c717ebd1d98c'
         '83e2314c8b80d0fd551fa083d89cef70'
         'e68bed0670b4a82dbd66512e8ca130c7'
         '48ea629311ec141de087474ad95fa122'
         '9c1849045f0004e49c240061358b244f'
         '72bce5d1aa3e6b21f6b7e7b6f2c8d4f2'
         '224a5bb2ee4fdde8cc20e79a70e30eab'
         'e856bf522ad406c3b17e605a922a149f'
         'e522dd90baf0fdc61fbd45a496993fed'
         'adc195bb74d8d84f768ab0077c6c80b2'
         'a8012c48c890655c1ef1826f900f7cd3'
         'fad33e552bd6fb805a5c92325c649eff'
         'cad39ebafc45aad5d32f115fa1839ac0'
         '238fa3a6a33cd30ad2712510cc578baa'
         '5dadee4c8eca35353e811b93a6602860'
         '67c7d7ab47d8cd636d6849f9fda68fe7'
         'b7cf88fe4b118aea853978c7ff43eb57'
         'c0aa19616cf37148a7f33789c9e88deb'
         '806a1b78d92c1e6504051f2c6bf2cdcf'
         '92ee27275709f2c81f229f40d032da23'
         '6f7369cff0c0680f52394d9caee7b136'
         '2adba18d2bd10051950f1b37325ddbce'
         'a2e1834d4b28fa8dea5b8d01adcedb7e'
         '929bfa11831b267b419a1b09b4d614d4'
         'fe5ea0a2cc3ee9b45618517a2a6cd162'
         '45cd4f3e44046bfdc78848d12a0983f9'
         '7f7681277e566052e6831377b1bcd479'
         'f136cefdb1b7a8b9fc18cba540414fcc'
         'e714caf6fc74f9978ca5911310f33f10'
         '7a745b384d1ee293decce327189d49e8'
         '5b22c59215b6ce6d3fd588305a6429f6'
         'b6f1f722168a7e2dc70b02c199e96198'
         'e490e5a65c40cd60ba64e4511f1dcef1'
         '640c52cb0b2e4f8ae0d7206fb3db3b33'
         'a42b31f567dcc8032360caa684df1c08'
         'd8da0314598179ac5c3479dd397d7827'
         '7e065b66f0673c3801ee7f37ff33344d'
         'c8c5d1646483013fa249b3a839523e53'
         'abf1db7ea2e8014e135f324cf3efc141'
         '8a352420c9580fe3c930a4b3c4d3530e'
         '465ca43f628d0567b3de36626b54bf40'
         '6cc860dae180ed5f80916759da290a9d'
         'b0d97a60501760c78f520ba4151427a7'
         '829311af6d4d0d78378fdcfd2cfccc68'
         'b54daae60d32b270a44b891fdb61e3b5'
         '39246a00ea31552326d0ea52f8eb1f05'
         'e49074be0a43ebc9810d89c24de75268'
         '281f20486ae5b6caadfc5504e7f036ac'
         '740c3a38b45788378c6c5db795d31ee1'
         '296df42d755d93032b9a3dc619bc502d'
         '74b59fa4676d2779f8e1081ac253b122'
         'a92960238a2c942c4b49b0f4187d0a71'
         '230fbd4b3e6a65545b4a37ec1549d0e6'
         'e606f5a9db88334a6cb33086340f4ff7'
         '0b52b803abe1acb1e137a57fe0497746'
         '00ddf2c8c6adfcd51230dd469d01ec75'
         '254303860ecc7c25157f08a4d55a4f68'
         '70d037f9c5c8f25e2b335c7016f17b58'
         'b3da484dade70c544d4f0e6a829ef806'
         '05347b208889b3e4aa86d9a6dccda71d'
         'a2212a06adac1aa6b74bc2f7e9de2af2'
         '371d5e9b0a10feec5e05d3fdfd949bc6'
         '63611b468b7d41a0470385e19a849a8d'
         'dc691a55cc7f95018e4178e6e794a1a4'
         '90723a80c36b85006fa7514641cd2f2a'
         '918683079f1d037d05a9a38b05d4ca51'
         '77dda2b5fd59bcdb66918b4d13b486ae'
         '33c2d8bff6cdf141614457c71fcf5d36'
         '08990457e150c081e0f505515c15df09'
         '379c5ede369994f016745e7dd83dfe54'
         '15062007856eb66b04c26694a7f35727'
         '569b1a54a9ca0b8149f151eb4cf57957'
         '970928f01c78b094a2c054e58cd85bff')