bugGNU gettext - Bugs: bug #56440, xgettext: search in comments

 
 

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

bug #56440: xgettext: search in comments

Submitter:  Cornelius Weiß <corneliusweiss>
Submitted:  Wed 05 Jun 2019 05:44:40 AM UTC
   
 
Category:  Programmer tools Severity:  3 - Normal
Item Group:  None Status:  Not a Bug
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Mon 10 Jun 2019 04:54:17 PM UTC, comment #1: 


> we have a lot of strings defined in static contexts where gettext can't run.


This case is discussed in https://www.gnu.org/software/gettext/manual/html_node/Special-cases.html . Define a gettext_noop function (in JavaScript, for example, in the global context) that returns its argument unmodified.

With this approach:
- You will not have to write down each string twice in the source code.
- You will not have to lie to xgettext about the language to parse.


Bruno Haible <haible>
Group administrator
Wed 05 Jun 2019 05:44:40 AM UTC, original submission:  

Hi,

in our project we have a lot of strings defined in static contexts where gettext can't run. So we place the getext calls into inline comments (see examples below).

In the last years we used Python mode for our php/js/xml code without problems as python does not know the // comment syntax.

Now we want to change to javascript mode to use the brand new es6 template string multiline feature of xgettext (https://savannah.gnu.org/bugs/?50920).

As javascript uses // as inline comment xgettext ignores these gettext calls. I did not find an option to force xgettext to include them.

did I miss something or can I kindly file this as feature request.

regards
Cornelius


Example (PHP):
<?php
    protected static $_properties = array(
        self::FIXED_CALENDARS => array(
            _('Fixed Calendars')
            'label'                 => 'Fixed Calendars',
...

Example (JS)
Tine.Calendar.Model.Attender = Tine.Tinebase.data.Record.create([{
    // ngettext('Event', 'Events', n); gettext('Events');
    containerName: 'Event',
    containersName: 'Events',
...

Example (XML)
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <plugin>Calendar_Export_Ods</plugin>
    <!-- _('OpenDocument all data') -->
    <label>OpenDocument all data</label>
    <!-- _('Export event data into ods spreadsheet') -->
    <description>Export event data into ods spreadsheet</description>

Cornelius Weiß <corneliusweiss>

 

(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 corneliusweiss (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-10 haible CategoryNone Programmer tools
        StatusNone Not a Bug
        Assigned toNone haible
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code