Answers.Body: <p>The <code>civistrings</code> command doesn't have a prescribed list of directories. It takes a list of paths (files or directories) as an input. For example, here's an excerpt of running it against the <code>api4</code> extension:</p>
  
  <pre><code>[nix-shell:~/bknix/build/dmaster/sites/all/modules/civicrm/ext/api4]$ civistrings $PWD
  #: CRM/Api4/Upgrader/Base.php
  msgid "Upgrade %1 to revision %2"
  msgstr ""
  
  #: Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php tests/phpunit/Action/CustomValueTest.php
  msgid "Custom Table Unique ID"
  msgstr ""
  
  #: Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php tests/phpunit/Action/CustomValueTest.php
  msgid "Entity ID"
  msgstr ""
  
  #: ang/api4/Explorer.html
  msgid "CiviCRM API v4"
  msgstr ""
  </code></pre>
  
  <p>At time of writing, the scanner will look for <code>ts()</code> expressions in any files which match the following:</p>
  
  <ul>
  <li>File-name ending with <code>.js</code> (parsed as Javascript code)</li>
  <li>File-name ending with <code>.html</code> (parsed as HTML with embedded Javascript)</li>
  <li>File-name ending with <code>.setting.php</code> (parsed as a Civi settings file)</li>
  <li>File-name ending with <code>.tpl</code> or <code>.hlp</code> (parsed as a Smarty file)</li>
  <li>File-name ending with <code>.php</code> or file-content starting with a PHP signifier in the first line (parsed as PHP code)</li>
  </ul>
  
  <p>This arrangement allows you to keep-it-simple in the typical case of a single extension (i.e. "just scan the entire extension and put all strings in one file"). This also allows you to deal with more complicated arrangements (e.g. <code>civicrm-core</code> is large and includes several components split among various subfolders). <code>civistrings</code> is focused on the technical mechanics of scanning for <code>ts()</code> -- and tries to be agnostic about the directory-structure.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-06T10:05:23.667Z
Answers.LastActivityDate: 2018-10-06T10:05:23.667Z
Answers.UserDisplayName: Tim Otten
Body: <p><a href="https://github.com/civicrm/civistrings" rel="nofollow noreferrer">CiviStrings</a> is a cli tool that scans an extension for translatable strings and generates a .pot file. According to the readme,</p>
  
  <blockquote>
    <p>It scans PHP, Smarty, JS, and partial HTML files for references to the ts() function -- and generates a list of strings using gettext's POT file format.</p>
  </blockquote>
  
  <p>I'd like to know which directories it scans in an extension. I know it will scan files in the <code>/ang</code> directory, but what if I place an html file somewhere else, like <code>/foo/bar.html</code> - will that file also get scanned?</p>
  
Tags: <extension><i18n>
Title: Which directories in an extension get scanned by CiviStrings
ThreadText: # Which directories in an extension get scanned by CiviStrings
  
  (Asked by: username_0 on 2018-10-04)
  
  [CiviStrings](https://github.com/civicrm/civistrings) is a cli tool that scans an extension for translatable strings and generates a .pot file. According to the readme,
  
  > It scans PHP, Smarty, JS, and partial HTML files for references to the ts() function -- and generates a list of strings using gettext's POT file format.
  
  I'd like to know which directories it scans in an extension. I know it will scan files in the `/ang` directory, but what if I place an html file somewhere else, like `/foo/bar.html` - will that file also get scanned?
  
  **Tags:** extension, i18n
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-06. Score: 3 | Accepted answer
  
  The `civistrings` command doesn't have a prescribed list of directories. It takes a list of paths (files or directories) as an input. For example, here's an excerpt of running it against the `api4` extension:
  
  ```
  [nix-shell:~/bknix/build/dmaster/sites/all/modules/civicrm/ext/api4]$ civistrings $PWD
  #: CRM/Api4/Upgrader/Base.php
  msgid "Upgrade %1 to revision %2"
  msgstr ""
  
  #: Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php tests/phpunit/Action/CustomValueTest.php
  msgid "Custom Table Unique ID"
  msgstr ""
  
  #: Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php tests/phpunit/Action/CustomValueTest.php
  msgid "Entity ID"
  msgstr ""
  
  #: ang/api4/Explorer.html
  msgid "CiviCRM API v4"
  msgstr ""
  
  ```
  
  At time of writing, the scanner will look for `ts()` expressions in any files which match the following:
  
  * File-name ending with `.js` (parsed as Javascript code)
  * File-name ending with `.html` (parsed as HTML with embedded Javascript)
  * File-name ending with `.setting.php` (parsed as a Civi settings file)
  * File-name ending with `.tpl` or `.hlp` (parsed as a Smarty file)
  * File-name ending with `.php` or file-content starting with a PHP signifier in the first line (parsed as PHP code)
  
  This arrangement allows you to keep-it-simple in the typical case of a single extension (i.e. "just scan the entire extension and put all strings in one file"). This also allows you to deal with more complicated arrangements (e.g. `civicrm-core` is large and includes several components split among various subfolders). `civistrings` is focused on the technical mechanics of scanning for `ts()` -- and tries to be agnostic about the directory-structure.
  
  
  ---
  
  