# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2


	# Moderne = selection of classic and reformed orthography
	# Classique = Moderne + more classical word variants (the recommended variant)
	# FR region hack to deal with LibreOffice bug, see src_prepare
	# Reforme 1990 = the reformed orthography
	# Toutes variantes = Classique + Reforme

	# FR region hack to deal with LibreOffice bug, see src_prepare

	# FR region hack to deal with LibreOffice bug, see src_prepare

inherit myspell-r2

DESCRIPTION="French dictionaries for myspell/hunspell"

KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-linux ~x86-macos"

src_prepare() {
	# Renaming so that variant subtags follow bcp47 rules
	# <https://tools.ietf.org/html/rfc5646#section-2.1>,
	# as this gives a nicer presentation in Firefox
	# (due to it following bcp47 rules)
	# fr-moderne is already OK
	# fr-classique is recommended so rename to fr
	mv fr-classique.aff fr.aff || die
	mv fr-classique.dic fr.dic || die
	# fr-reforme1990 changed to fr-1990 similarly to de-1901 and de-1996
	mv fr-reforme1990.aff fr-1990.aff || die
	mv fr-reforme1990.dic fr-1990.dic || die
	# fr-toutesvariantes changed to fr-ttsvars until we find something better
	mv fr-toutesvariantes.aff fr-ttsvars.aff || die
	mv fr-toutesvariantes.dic fr-ttsvars.dic || die

	# To deal with LibreOffice bug
	# https://bugs.documentfoundation.org/show_bug.cgi?id=64830
	# we need dictionary/thesaurus/hyphenation files named fr_FR
	# (or should that be fr-FR?), so we rename the recommended one fr here.
	# This is hopefully temporary, so we keep this separate from
	# the bcp47-ification above.
	mv fr.aff fr_FR.aff || die
	mv fr.dic fr_FR.dic || die
	mv hyph_fr.dic hyph_fr_FR.dic || die
	# thes -> th and extra v2 suffix, again to appease LibreOffice
	mv thes_fr.dat th_fr_FR_v2.dat || die
	mv thes_fr.idx th_fr_FR_v2.idx || die