[Rpm-maint] [rpm-software-management/rpm] The find-lang.sh did't consider Alpha-3 code language (#1642)

sixg0000d notifications at github.com
Fri Apr 16 16:41:47 UTC 2021


https://bugzilla.redhat.com/show_bug.cgi?id=1894854

### Description of problem:
The find-lang script cannot find qm files when my qm file name with a [ISO 639-3](https://en.wikipedia.org/wiki/ISO_639-3) code like `yue.qm` .

### Version-Release number of selected component (if applicable):

```
$ rpm -qf /usr/lib/rpm/find-lang.sh
rpm-build-4.16.0-1.fc33.x86_64
```

### How reproducible:
always

### Steps to Reproduce:
1. Has some qm files in buildroot

```
$ ls path/usr/share/name/lang/
en_US.qm  ja_JP.qm  yue_HK.qm  yue.qm  zh_CN.qm  zh_TW.qm
```

2. Try to use script to handle there

`$ /usr/lib/rpm/find-lang.sh path name --with-qt --all-name`

### Actual results:

```
$ cat name.lang 
%lang(en_US) /usr/share/name/lang/en_US.qm
%lang(ja_JP) /usr/share/name/lang/ja_JP.qm
%lang(zh_CN) /usr/share/name/lang/zh_CN.qm
%lang(zh_TW) /usr/share/name/lang/zh_TW.qm
# This is a wrong locale code, because it is missing language code
%lang(HK) /usr/share/name/lang/yue_HK.qm

```

### Expected results:

```
$ cat name.lang 
%lang(en_US) /usr/share/name/lang/en_US.qm
%lang(ja_JP) /usr/share/name/lang/ja_JP.qm
%lang(zh_CN) /usr/share/name/lang/zh_CN.qm
%lang(zh_TW) /usr/share/name/lang/zh_TW.qm
%lang(yue_HK) /usr/share/name/lang/yue_HK.qm
%lang(yue) /usr/share/name/lang/yue.qm
```

### Additional info:

I think the problem is in the sed expression in the script:

```bash
'
s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$QT"'s:\(.*/'"$NAME"'_\([a-zA-Z]\{2\}\([_@].*\)\?\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/[^/_]\+_\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/[^/_]\+_\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1:
s:^[^%].*::
s:%lang(C) ::
/^$/d'
```

It seems that it only captures the Alpha-2 code, and misses the Alpha-3 code.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1642
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20210416/bbf3191c/attachment.html>


More information about the Rpm-maint mailing list