# Template file for 'firefox-i18n'
pkgname=firefox-i18n
version=125.0.1
revision=1
build_style=meta
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"'
	'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"'
	'si     "Sinhala"'
	'sk     "Slovak"'
	'sl     "Slovenian"'
	'son    "Songhai"'
	'sq     "Albanian"'
	'sr     "Serbian"'
	'sv-SE  "Swedish"'
	'ta     "Tamil"'
	'te     "Telugu"'
	'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-i686/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="96165cf6f9aed8ac073200f420b125ceb38bd22913e78657b7d1905e041ab256
[encoded data, 6204 characters]
 9f4afc30db5d9edffdc3e61197d1b6064cd73eeeac49cf22a227fbda53fb97d6"
