# Template file for 'icecat-i18n'
pkgname=icecat-i18n
version=52.6.0
revision=1
build_style=meta
homepage="https://directory.fsf.org/wiki/IceCat"
short_desc="IceCat language packs"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="MPL-2.1"

nocross=yes
create_wrksrc=yes

do_extract() {
	:
}
do_install() {
	:
}

_languages=(
  'ach             "Acholi"'
  'af              "Afrikaans"'
  'an              "Aragonese"'
  'ar              "Arabic"'
  'as              "Assamese"'
  'ast             "Asturian"'
  'az              "Azerbaijani"'
  'bg              "Bulgarian"'
  'bn-BD           "Bengali (Bangladesh)"'
  'bn-IN           "Bengali (India)"'
  'br              "Breton"'
  'bs              "Bosnian"'
  'ca              "Catalan"'
  'cak             "Kaqchikel"'
  'compare-locales "Compare Locales"'
  'cs              "Czech"'
  'cy              "Welsh"'
  'da              "Danish"'
  'de              "German"'
  'dsb             "Lower Sorbian"'
  'el              "Greek"'
  'en-GB           "English (British)"'
  'en-US           "English (US)"'
  'en-ZA           "English (South African)"'
  'eo              "Esperanto"'
  'es-AR           "Spanish (Argentina)"'
  'es-CL           "Spanish (Chile)"'
  'es-ES           "Spanish (Spain)"'
  'es-MX           "Spanish (Mexico)"'
  'et              "Estonian"'
  'eu              "Basque"'
  'fa              "Persian"'
  'ff              "Fulah"'
  'fi              "Finnish"'
  'fr              "French"'
  'fy-NL           "Frisian"'
  'ga-IE           "Irish"'
  'gd              "Gaelic (Scotland)"'
  'gl              "Galician"'
  'gn              "Guarani"'
  'gu-IN           "Gujarati (India)"'
  'he              "Hebrew"'
  'hi-IN           "Hindi (India)"'
  'hr              "Croatian"'
  'hsb             "Upper Sorbian"'
  'hu              "Hungarian"'
  'hy-AM           "Armenian"'
  'id              "Indonesian"'
  'is              "Icelandic"'
  'it              "Italian"'
  'ja-JP-mac       "Japanese (Mac)"'
  'ja              "Japanese"'
  'ka              "Georgian"'
  'kab             "Kabyle"'
  'kk              "Kazakh"'
  'km              "Khmer"'
  'kn              "Kannada"'
  'ko              "Korean"'
  'lij             "Ligurian"'
  'lt              "Lithuanian"'
  'lv              "Latvian"'
  'mai             "Maithili"'
  'mk              "Macedonian"'
  'ml              "Malayalam"'
  'mr              "Marathi"'
  'ms              "Malay"'
  'nb-NO           "Norwegian (Bokmål)"'
  'nl              "Dutch (Netherlands)"'
  'nn-NO           "Norwegian (Nynorsk)"'
  'or              "Oriya"'
  'pa-IN           "Punjabi (India)"'
  'pl              "Polish"'
  'pt-BR           "Portuguese (Brazilian)"'
  'pt-PT           "Portuguese (Portugal)"'
  'rm              "Romansh"'
  'ro              "Romanian"'
  'ru              "Russian"'
  'si              "Sinhala"'
  'sk              "Slovak"'
  'sl              "Slovenian"'
  'son             "Songhai"'
  'sq              "Albanian"'
  'sr              "Serbian"'
  'sv-SE           "Swedish"'
  'ta              "Tamil"'
  'te              "Telugu"'
  'th              "Thai"'
  'tr              "Turkish"'
  'uk              "Ukrainian"'
  'uz              "Uzbek"'
  'vi              "Vietnamese"'
  'xh              "Xhosa"'
  'zh-CN           "Chinese (China)"'
  'zh-TW           "Chinese (Taiwan)"'
)

depends="icecat>=${version}"

for _lang in "${_languages[@]}"; do
	_locale="${_lang%% *}"
	_pkgname=icecat-i18n-${_locale}

	depends+=" ${_pkgname}>=${version}"
	distfiles+=" ${GNU_SITE}/gnuzilla/${version}/langpacks/icecat-${version}.${_locale}.langpack.xpi"
	distfiles+=" ${GNU_SITE}/gnuzilla/${version}/langpacks/icecat-${version}.${_locale}.langpack.xpi.sig"

	eval "${_pkgname}_package() {
		_pkgtmpl $_lang
	}"
done

_pkgtmpl() {
	_lang="$1"
	depends="icecat>=${version}"
	short_desc="IceCat $2 language pack"
	pkg_install() {
		_name=icecat-${version}.${_lang}.langpack.xpi
		vinstall ${XBPS_SRCDISTDIR}/${sourcepkg}-${version}/${_name} 644 \
			usr/lib/icecat/browser/extensions
		vinstall ${XBPS_SRCDISTDIR}/${sourcepkg}-${version}/${_name}.sig 644 \
			usr/lib/icecat/browser/extensions
	}
}

checksum="
[encoded data, 12342 characters]
 8531d921002d39c1b06c16e5beac9810e022a64370f597fe027990cc7656ea7b"
