# Template file for 'firefox-i18n'
pkgname=firefox-i18n
version=152.0
revision=1
metapackage=yes
short_desc="Firefox language packs"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MPL-2.0"
homepage="https://www.mozilla.org/firefox/"

create_wrksrc=yes

do_extract() {
	:
}

_languages=(
	'ach         "Acholi"'
	'af          "Afrikaans"'
	'an          "Aragonese"'
	'ar          "Arabic"'
	'ast         "Asturian"'
	'az          "Azerbaijani"'
	'be          "Belarusian"'
	'bg          "Bulgarian"'
	'bn          "Bengali"'
	'br          "Breton"'
	'bs          "Bosnian"'
	'ca          "Catalan"'
	'ca-valencia "Catalan (Valencian)"'
	'cak         "Kaqchikel"'
	'cs          "Czech"'
	'cy          "Welsh"'
	'da          "Danish"'
	'de          "German"'
	'dsb         "Lower Sorbian"'
	'el          "Greek"'
	'en-CA       "English (Canada)"'
	'en-GB       "English (British)"'
	'en-US       "English (US)"'
	'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"'
	'fur         "Friulian"'
	'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"'
	'ia          "Interlingua"'
	'id          "Indonesian"'
	'is          "Icelandic"'
	'it          "Italian"'
	'ja          "Japanese"'
	'ka          "Georgian"'
	'kab         "Kabyle"'
	'kk          "Kazakh"'
	'km          "Khmer"'
	'kn          "Kannada"'
	'ko          "Korean"'
	'lij         "Ligurian"'
	'lt          "Lithuanian"'
	'lv          "Latvian"'
	'mk          "Macedonian"'
	'mr          "Marathi"'
	'ms          "Malay"'
	'my          "Burmese"'
	'nb-NO       "Norwegian (Bokmål)"'
	'ne-NP       "Nepali"'
	'nl          "Dutch"'
	'nn-NO       "Norwegian (Nynorsk)"'
	'oc          "Occitan"'
	'pa-IN       "Punjabi"'
	'pl          "Polish"'
	'pt-BR       "Portuguese (Brazilian)"'
	'pt-PT       "Portuguese (Portugal)"'
	'rm          "Romansh"'
	'ro          "Romanian"'
	'ru          "Russian"'
	'sat         "Santali"'
	'sc          "Sardinian"'
	'sco         "Scots"'
	'si          "Sinhala"'
	'sk          "Slovak"'
	'skr         "Saraiki"'
	'sl          "Slovenian"'
	'son         "Songhai"'
	'sq          "Albanian"'
	'sr          "Serbian"'
	'sv-SE       "Swedish"'
	'szl         "Silesian"'
	'ta          "Tamil"'
	'te          "Telugu"'
	'tg          "Tajik"'
	'th          "Thai"'
	'tl          "Tagalog"'
	'tr          "Turkish"'
	'trs         "Triqui"'
	'uk          "Ukrainian"'
	'ur          "Urdu"'
	'uz          "Uzbek"'
	'vi          "Vietnamese"'
	'xh          "Xhosa"'
	'zh-CN       "Chinese (Simplified)"'
	'zh-TW       "Chinese (Traditional)"'
)

# XXX: Remove makedeps later, just for build ordering on the build servers
makedepends="firefox"
depends="firefox>=${version}"

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

	depends+=" ${_pkgname}>=${version}"
	distfiles+=" ${MOZILLA_SITE}/firefox/releases/${version}/linux-x86_64/xpi/${_locale}.xpi"

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

_pkgtmpl() {
	_lang="$1"
	depends="firefox>=${version}"
	conflicts="firefox-esr-i18n-${_lang}>=0"
	short_desc="Firefox $2 language pack"
	pkg_install() {
		vinstall ${XBPS_SRCDISTDIR}/${sourcepkg}-${version}/${_lang}.xpi 644 \
			usr/lib/firefox/browser/extensions langpack-${_lang}@firefox.mozilla.org.xpi
	}
}

checksum="1553e27e650e3a9fa16c5d370f1c1a67e7caf79662e42e9316508edf9d0edc89
[encoded data, 6666 characters]
 e3babd41509fda1226a471ce9723ff3a4a41c377d1c78feac20738007bf841c4"
