# Template file for 'icecat-i18n'
pkgname=icecat-i18n
version=38.6.0
revision=2
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"

create_wrksrc=yes

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

_languages=(
	'ach        "Acholi"'
	'af         "Afrikaans"'
	'an         "Aragonese"'
	'ar         "Arabic"'
	'as         "Assamese"'
	'ast        "Asturian"'
	'az         "Azerbaijani"'
	'be         "Belarusian"'
	'bg         "Bulgarian"'
	'bn-BD      "Bengali (Bangladesh)"'
	'bn-IN      "Bengali (India)"'
	'br         "Breton"'
	'bs         "Bosnian"'
	'ca         "Catalan"'
	'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"'
	'gu-IN      "Gujarati"'
	'he         "Hebrew"'
	'hi-IN      "Hindi (India)"'
	'hr         "Croatian"'
	'hsb        "Upper Sorbian"'
	'hu         "Hungarian"'
	'hy-AM      "Armenian"'
	'id         "Indonesian"'
	'is         "Icelandic"'
	'it         "Italian"'
	'ja         "Japanese"'
	'ja-JP-mac  "Japanese (Mac)"'
	'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"'
	'nn-NO      "Norwegian (Nynorsk)"'
	'or         "Oriya"'
	'pa-IN      "Punjabi"'
	'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 (Simplified)"'
	'zh-TW      "Chinese (Traditional)"'
)

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, 11700 characters]
"
