bugGNU gettext - Bugs: bug #59062, po.m4: LINGUAS check should...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #59062: po.m4: LINGUAS check should exclude .po files for unrelated languages

Submitter:  Arfrever <arfrever>
Submitted:  Fri 04 Sep 2020 04:52:00 AM UTC
   
 
Category:  Programmer tools Severity:  3 - Normal
Item Group:  None Status:  Fix Released
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Sun 01 Dec 2024 04:34:04 PM UTC, comment #5: 

The fix is contained in gettext 0.23.

Bruno Haible <haible>
Group administrator
Thu 17 Oct 2024 10:08:01 PM UTC, comment #4: 

Thanks for noticing that my commit was not consistent with the documentation.

po.m4 implements the desirable behaviour: It allows the installer to do

LINGUAS=pt ./configure

and get pt.mo installed, and to do

LINGUAS=pt_BR ./configure

and get pt.mo, pt_BR.mo installed.

Regarding Chinese, it is more useful to be able to do

LINGUAS=zh_TW ./configure

and get zh_TW.mo installed, than to be able to do

LINGUAS=zh ./configure

and get zh_CN.mo and zh_TW both installed.

I have therefore updated the documentation:
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=b147f89713702b54ee25ad2101366f3927766d3b

> - ISO 639 is a group of several standards. Language codes can be two-letter or three-letter. (https://en.wikipedia.org/wiki/ISO_639)


Good point. Fixed through the doc change.

> - Potential _*, .*, @* parts of names of .po files are not mentioned.


It is mentioned in some places. No need to mention it each time.

> - Matching is not described.


It doesn't need to be described; it's an internal detail.

Bruno Haible <haible>
Group administrator
Mon 07 Sep 2020 12:36:42 PM UTC, comment #3: 

Also documentation is incomplete in:
https://www.gnu.org/software/gettext/manual/html_node/Installers.html
https://www.gnu.org/software/gettext/manual/html_node/INSTALL-Matters.html

- ISO 639 is a group of several standards. Language codes can be two-letter or three-letter. (https://en.wikipedia.org/wiki/ISO_639)
- Potential _*, .*, @* parts of names of .po files are not mentioned.
- Matching is not described.

Arfrever <arfrever>
Mon 07 Sep 2020 11:14:30 AM UTC, comment #2: 

After more testing, it appears that in both my patch and in your commit, usage of variables is inverted.

When user sets LINGUAS="... zh ..." and zh_CN.po and zh_TW.po files exist, values of variables during some iterations of those loops would be:

desiredlang="zh"
presentlang="zh_CN"

desiredlang="zh"
presentlang="zh_TW"


The current comment implies that zh is variant of zh_CN and zh_TW, but it is the other way round, i.e. zh_CN and zh_TW are variants of zh.

I will attach new patch, which fixes usage of variables.

I have now verified that e.g. setting LINGUAS="en fr ja zh" for gettext project results in:

gettext-runtime/po/Makefile:CATALOGS =  en@quot.gmo en@boldquot.gmo fr.gmo ja.gmo zh_CN.gmo zh_HK.gmo zh_TW.gmo
gettext-tools/po/Makefile:CATALOGS =  en@quot.gmo en@boldquot.gmo fr.gmo ja.gmo zh_CN.gmo zh_TW.gmo


(file #49753)

Arfrever <arfrever>
Sun 06 Sep 2020 07:32:39 PM UTC, comment #1: 

Thanks for the report.
Fixed through this commit:
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=3ab3933d54fe2ae030203658fac59c845ae554c8

I didn't take your patch, because your comment changes confused me, and the syntax character '.' needs to be considered as well.

Bruno Haible <haible>
Group administrator
Fri 04 Sep 2020 04:52:00 AM UTC, original submission:  

po.m4 contains:

          # CATALOGS depends on both $ac_dir and the user's LINGUAS
          # environment variable.
          INST_LINGUAS=
          if test -n "$ALL_LINGUAS"; then
            for presentlang in $ALL_LINGUAS; do
              useit=no
              if test "%UNSET%" != "$LINGUAS"; then
                desiredlanguages="$LINGUAS"
              else
                desiredlanguages="$ALL_LINGUAS"
              fi
              for desiredlang in $desiredlanguages; do
                # Use the presentlang catalog if desiredlang is
                #   a. equal to presentlang, or
                #   b. a variant of presentlang (because in this case,
                #      presentlang can be used as a fallback for messages
                #      which are not translated in the desiredlang catalog).
                case "$desiredlang" in
                  "$presentlang"*) useit=yes;;
                esac
              done
              if test $useit = yes; then
                INST_LINGUAS="$INST_LINGUAS $presentlang"
              fi
            done
          fi
          CATALOGS=
          if test -n "$INST_LINGUAS"; then
            for lang in $INST_LINGUAS; do
              CATALOGS="$CATALOGS $lang.gmo"
            done
          fi


This allows an xx element to match xx or xx@yy or xx_ZZ, but it also unexpectedly matches xxa.

E.g. LINGUAS="fr" currently would enable processing of fr.po, fr_FR.po (French language) and unexpectedly also frr.po (North Frisian language).

Probable fix is to change 'case' check to be:

case "$desiredlang" in
  "$presentlang"|"$presentlang"@*|"$presentlang"_*) useit=yes;;
esac


Arfrever <arfrever>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #49753:  gettext.patch added by arfrever (3KiB - text/x-patch)
file #49741:  gettext.patch added by arfrever (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by arfrever (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-12-01 haible StatusFixed Fix Released
    2024-10-17 haible CategoryBuild Programmer tools
        StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2023-01-04 haible StatusFixed In Progress
        Open/ClosedClosed Open
    2020-09-07 arfrever Attached File- Added gettext.patch, #49753
    2020-09-06 haible CategoryNone Build
        StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed
    2020-09-04 arfrever Attached File- Added gettext.patch, #49741

    Back to the top

    Powered by Savane 3.15-e6e5.
    Corresponding source code