This program can be used to analyze the translations of extensions for the CMS Joomla!. It automatically checks for untranslated and unused language strings and allows extension developers to provide complete translation files.
Download the repository contents and unpack it somewhere on your web server. It is recommended to use the program on a local web server or a remote server with restricted access (e.g. via a .htaccess file).
Create a folder called extensions inside the unpacked folder. Your extensions need to be placed inside this folder. You can do this either by copying your code base to the folder or, for convenience, using symlinks to the code base.
In your web browser, navigate to the index.php file. You should see a form. Enter the name of your extension (e.g. com_mycomponent or mod_mymodule) or select it from the list of proposals.
The program analyzes the language files and your code base and prints the results.
The program lists all language files it has analyzed, grouped by language and split between administrator and site files for components. Other types of extensions have only one part.
Here you will find all untranslated language strings - language strings found in the code base, but not inside the language files.
Language strings are recognized if they follow the scheme of EXTENSION_[A-Z_]*, e.g. COM_MYCOMPONENT_ERROR_NOT_FOUND.
The program lists all language strings that are translated in the language file, but not found in the code base.
The strings for the admin part are those found at these parts of the code base:
.phpfiles inside theadmindirectory.xmlfiles inside theadmindirectory.xmlfiles inside thesitedirectory, because they contain menu parameters that are displayed in the backend
The strings for the site part are those found at these parts of the code base:
.phpfiles inside thesitedirectory.xmlfiles inside the following directories, because they might contain parameters used in frontend forms:admin/model/fieldadmin/model/formadmin/models/fieldsadmin/models/forms
If some language strings are detected as unused or missing, but you don't want them to appear in the list, because their current occurrence suits your application, you can hide them from the output. To do so, just click the small eye symbol next to the string. In order to show a hidden language string again, navigate to the configuration page for your extension and click on the eye symbol next to the string in the list of hidden strings.
- The program only recognizes complete strings. If you have a construction like
JText::_('COM_MYCOMPONENT_TITLE_' . ($isNew ? 'NEW' : 'EDIT'))and the two stringsCOM_MYCOMPONENT_TITLE_NEWandCOM_MYCOMPONENT_TITLE_EDITtranslated in your language files, the program will recognizeCOM_MYCOMPONENT_TITLE_as untranslated andCOM_MYCOMPONENT_TITLE_NEWandCOM_MYCOMPONENT_TITLE_EDITas translated, but unused. You can hide these strings if you wish to (see Hiding / Showing Strings) - Depending on which parts of your extension are displayed where (especially concerning forms and parameters), it is possible that you don't need all language strings marked as unused in both language files (site and admin).
- The support for
.sys.inifiles is not yet implemented.
If you encounter bugs, have suggestions for new features or code proposals, please open an issue or a pull request.
Copyright 2018 Constantin Romankiewicz
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.