1 |
On Sat, May 7, 2016 at 10:13 PM, James Le Cuirot <chewi@g.o> wrote: |
2 |
> l10n_find_plocales_change assumes that PLOCALES is sorted |
3 |
> alphanumerically with a single space between each entry and no |
4 |
> surrounding whitespace. This is not a bad assumption but it isn't |
5 |
> documented and it's inconvenient in at least one particular case. |
6 |
> |
7 |
> MakeMKV uses non-standard locale names and I intend to map these using |
8 |
> an associative array, which is possible as of EAPI 6. This allows me |
9 |
> to do the following, though only with the above change as associative |
10 |
> arrays are not ordered. |
11 |
> |
12 |
> declare -A MY_LOCALES |
13 |
> MY_LOCALES=( [zh]=chi [da]=dan … ) |
14 |
> PLOCALES="${!MY_LOCALES[@]}" |
15 |
> inherit l10n |
16 |
> |
17 |
> src_prepare() { |
18 |
> PLOCALES="${MY_LOCALES[@]}" l10n_find_plocales_changes … |
19 |
> } |
20 |
> |
21 |
> src_install() { |
22 |
> for locale in $(l10n_get_locales); do |
23 |
> doins makemkv_${MY_LOCALES[${locale}]}.mo.gz |
24 |
> done |
25 |
> } |
26 |
> --- |
27 |
> eclass/l10n.eclass | 2 +- |
28 |
> 1 file changed, 1 insertion(+), 1 deletion(-) |
29 |
> |
30 |
> diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass |
31 |
> index a7a6a26..26aa864 100644 |
32 |
> --- a/eclass/l10n.eclass |
33 |
> +++ b/eclass/l10n.eclass |
34 |
> @@ -86,7 +86,7 @@ l10n_find_plocales_changes() { |
35 |
> current+="${x} " |
36 |
> done |
37 |
> popd >/dev/null |
38 |
> - if [[ ${PLOCALES} != ${current%[[:space:]]} ]] ; then |
39 |
> + if [[ $(tr -s "[:space:]" "\n" <<< "${PLOCALES}" | sort | xargs echo) != ${current%[[:space:]]} ]] ; then |
40 |
> einfo "There are changes in locales! This ebuild should be updated to:" |
41 |
> einfo "PLOCALES=\"${current%[[:space:]]}\"" |
42 |
> else |
43 |
> -- |
44 |
> 2.7.1 |
45 |
|
46 |
Does this also fix bug 513242? |
47 |
|
48 |
Thanks, |
49 |
Davide |