1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
9 MY_PV="${PV/_alpha/.alpha}"
10 MY_PV="${MY_PV/_beta/.beta}"
11 [[ ${PV} == *alpha* || ${PV} == *beta* ]] && PN_DEV="Dev"
13 DESCRIPTION="Translations for the Libreoffice suite"
14 HOMEPAGE="https://www.libreoffice.org"
15 BASE_SRC_URI_TESTING="https://download.documentfoundation.org/${PN/-l10n/}/testing/${BASE_PV}/rpm"
16 BASE_SRC_URI_STABLE="https://download.documentfoundation.org/${PN/-l10n/}/stable/${BASE_PV}/rpm"
18 LICENSE="|| ( LGPL-3 MPL-1.1 )"
20 KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
24 # when changing the language lists, please be careful to preserve the spaces (bug 491728)
26 # "en:en-US" for mapping from Gentoo "en" to upstream "en-US" etc.
27 LANGUAGES_HELP=" am ast bg bn-IN bn bo bs ca-valencia ca cs da de dz el en-GB en:en-US en-ZA eo es et eu fi fr gl gu he hi hr hu id is it ja ka km ko mk nb ne nl nn om pl pt-BR pt ru si sk sl sq sv tg tr ug uk vi zh-CN zh-TW "
28 LANGUAGES="${LANGUAGES_HELP}af ar as be br brx cy dgo fa ga gd gug kk kmr-Latn kn kok ks lb lo lt lv mai ml mn mni mr my nr nso oc or pa:pa-IN ro rw sa:sa-IN sat sd sid sr-Latn sr ss st sw-TZ ta te th tn ts tt uz ve xh zu "
30 for lang in ${LANGUAGES_HELP}; do
31 helppack="offlinehelp? ( ${BASE_SRC_URI_STABLE}/x86_64/LibreOffice${PN_DEV}_${BASE_PV}_Linux_x86-64_rpm_helppack_${lang#*:}.tar.gz -> LibreOffice_${MY_PV}_Linux_x86-64_rpm_helppack_${lang#*:}.tar.gz ${BASE_SRC_URI_TESTING}/x86_64/LibreOffice${PN_DEV}_${MY_PV}_Linux_x86-64_rpm_helppack_${lang#*:}.tar.gz -> LibreOffice_${MY_PV}_Linux_x86-64_rpm_helppack_${lang#*:}.tar.gz )"
32 SRC_URI+=" l10n_${lang%:*}? ( ${helppack} )"
34 for lang in ${LANGUAGES}; do
35 if [[ ${lang%:*} != en ]]; then
36 langpack="${BASE_SRC_URI_STABLE}/x86_64/LibreOffice${PN_DEV}_${BASE_PV}_Linux_x86-64_rpm_langpack_${lang#*:}.tar.gz -> LibreOffice_${MY_PV}_Linux_x86-64_rpm_langpack_${lang#*:}.tar.gz ${BASE_SRC_URI_TESTING}/x86_64/LibreOffice${PN_DEV}_${MY_PV}_Linux_x86-64_rpm_langpack_${lang#*:}.tar.gz -> LibreOffice_${MY_PV}_Linux_x86-64_rpm_langpack_${lang#*:}.tar.gz"
37 SRC_URI+=" l10n_${lang%:*}? ( ${langpack} )"
39 IUSE+=" l10n_${lang%:*}"
41 unset lang helppack langpack
43 RDEPEND+="app-text/hunspell"
54 # First remove dictionaries, we want to use system ones.
55 find "${S}" -name *dict*.rpm -delete || die "Failed to remove dictionaries"
57 for lang in ${LANGUAGES}; do
58 # break away if not enabled
59 use l10n_${lang%:*} || continue
63 # for english we provide just helppack, as translation is always there
64 if [[ ${lang%:*} != en ]]; then
65 rpmdir="LibreOffice_${MY_PV}_Linux_x86-64_rpm_langpack_${dir}/RPMS/"
66 [[ -d ${rpmdir} ]] || die "Missing directory: ${rpmdir}"
67 rpm_unpack ./${rpmdir}/*.rpm
69 if [[ "${LANGUAGES_HELP}" =~ " ${lang} " ]] && use offlinehelp; then
70 rpmdir="LibreOffice_${MY_PV}_Linux_x86-64_rpm_helppack_${dir}/RPMS/"
71 [[ -d ${rpmdir} ]] || die "Missing directory: ${rpmdir}"
72 rpm_unpack ./${rpmdir}/*.rpm
77 src_configure() { :; }
81 local dir="${S}"/opt/${PN/-l10n/}$(ver_cut 1-2)/
82 # Condition required for people who do not install anything e.g. no l10n
83 # or just english with no offlinehelp.
84 if [[ -d "${dir}" ]] ; then
85 insinto /usr/$(get_libdir)/${PN/-l10n/}/
88 # remove extensions that are in l10n for some weird reason
89 rm -rf "${ED}"/usr/$(get_libdir)/${PN/-l10n/}/share/extensions/ || \
90 die "Failed to remove extensions"