Skip to content

Adding extension html for translatable files inside findTranslatableFiles() method, so that html files will be found (solution included!!) #480

@juergenweb

Description

@juergenweb

Short description of the enhancement

Include files with extension html in the translatable files, not only php, module and inc.

Current vs. suggested behavior

By default, only files with the extension php, module or inc will be found to be translatable. I am using html files with translatable strings too, but they will not be found until you enter the path manually at the bottom of the "Select file(s)" page in the backend.

Why would the enhancement be useful to users?

I use HTML files with translatable strings for my email templates and if I want to translate them, I had to add the files manually by adding the path to the files at the bottom inside the text input for "Enter file to translate". This assumes that you know, that there are translatable strings inside the HTML files and requires and extra step. If you are using HTML files with translatable strings inside a module, like in my case, people who are using this module will not know, that there are HTML files with translatable strings inside. This leads to, that they do not enter the files manually and the email texts will not be translated.
Adding HTML files by default will solve this issue.

Simple implementation by adding only some strings

To allow files with html extension, you only need to go to line 817 of ProcessLanguageTranslator.module and replace the following line

if($ext != 'php' && $ext != 'module' && $ext != 'inc') continue;

with the following

if($ext != 'php' && $ext != 'module' && $ext != 'inc' && $ext != 'html') continue;

This has no negative side effect and will help to find translatable strings in html files by default

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions