bugGNU gettext - Bugs: bug #62337, Support complex PHP variables in a...

 
 

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

bug #62337: Support complex PHP variables in a string

Submitter:  Silvério <sil>
Submitted:  Wed 20 Apr 2022 11:11:24 AM UTC
   
 
Category:  PHP Severity:  3 - Normal
Item Group:  None Status:  Answer Provided
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Thu 19 Sep 2024 09:35:48 PM UTC, comment #1: 


> while those including them are skipped.


This is as expected. It would make no sense to add such strings to the POT file, because at runtime the substitution of variable values into the string would happen before the lookup in the message catalog. Substitution of variable values into the string needs to happen into the string returned from the message catalog.

Programmer documentation has been added here:
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=4df2df7213075afefe4c28132dcc1f97b6e99aa5

Bruno Haible <haible>
Group administrator
Wed 20 Apr 2022 11:11:24 AM UTC, original submission:  

System: Debian Bullseye
xgettext version: 0.21

When running

xgettext -l PHP ...

on a PHP source file with translatable strings in the function

_()

 and enclosed in double ", only the ones without complex aka. curly variables in the string are identified and added to the .pot, while those including them are skipped.
Also found no way to manually add those strings into the .pot, that is overwritten by invocations of xgettext, effectively leaving those strings out.

- Expected behavior: Include the strings with complex syntax with the content of {$<expression>} (where expression is a PHP expression) to be copied as is into msgid.
- Observed behavior: Strings with complex syntax are completely skipped.

Silvério <sil>

 

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

No files currently attached

 

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 sil (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-09-19 haible StatusNone Answer Provided
        Assigned toNone haible
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.15-e6e5.
    Corresponding source code