[Resolved] String Translation - domain is missing from the list
This thread is resolved. Here is a description of the problem and solution.
Problem:
String Translation - domain is missing from the list when using HAML Solution:
The 4.0.7 version is an older version and since then there have been plenty of changes made to our code.
As WPML itself does not scan or officially support HAML files I wouldn't be able to point out what change was made that could have caused this behavior with HAML files.
One of the functions that scan the templates has changed. It's possible the new function does not scan non-PHP files
Line 31 of wpml-string-translation\classes\strings-scanning\wpml-st-theme-plugin-scan-dir-ajax.php will allow .haml files to be scanned by changing:
$file_type = array( 'php', 'inc' );
to
$file_type = array( 'php', 'inc', 'haml' );
However, I tried this and it doesn't catch the strings in Haml.
You might want to examine the following file which should be where all the actual processing is happening:
wpml-string-translation\inc\potx.php
NOTE: I did test with version 4.0.7 of WPML and its version at the time of String Translation and it still does not scan HAML files.
Once you go to WPML->Themes and Plugins localization-> Scan your theme and then you get a list of all the files scanned, only .php files are scanned.
And then the strings are located within /haml-templates/front-page.haml
for example: = __('Contact us today', 'bogoroch')
We previously used an older version of WPML (4.0.7) with another project of ours that uses HAML templates and we didn't have an issue getting the translation strings to appear within WPML.
I believe that as long as you are using the Gettext call in an HTML file and not a HAML file then it should work as expected.
Change your text-domain temporary for one string from bogoroch to 'bogoroch-test' and save it and then go back to WPML->Themes and Plugins localization and see if the new text-domain populates under the theme
Once again, this setup worked just fine with the older WPML version 4.0.7, but it doesn't seem to be working any longer with the latest WPML. Is there a workaround?
Were you able to test changing the text-domain? This will allow you to see if a specific string is getting picked up.
Please note that we currently are not able to provide support for custom work within this forum. I will, however, like to take a closer look and see if something is missing and why its not getting picked up.
I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)
**Before we proceed I recommend taking FULL BACKUP of your database and your website.**
I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.
NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.
Go to WPML->String translation->Filter by strings within the domain "text-domain" or "bogroch" and click on the View.
You will notice that all these strings that have been picked up by String Translation are coming from pure PHP files such as functions.php or /custom-post-type.php for example.
This is because any getText call function called within the HAML file does not seem to work.
-----------------
As noted in my previous thread being that you are using a custom theme and custom code we are not able to provide support for custom work within this forum, but I have inquired our developers regarding HAML and WPML, and will update you once I have their response.
The 4.0.7 version is an older version and since then there have been plenty of changes made to our code.
As WPML itself does not scan or officially support HAML files I wouldn't be able to point out what change was made that could have caused this behavior with HAML files.
One of the functions that scan the templates has changed. It's possible the new function does not scan non-PHP files
Line 31 of wpml-string-translation\classes\strings-scanning\wpml-st-theme-plugin-scan-dir-ajax.php will allow .haml files to be scanned by changing:
$file_type = array( 'php', 'inc' );
to
$file_type = array( 'php', 'inc', 'haml' );
However, I tried this and it doesn't catch the strings in Haml.
You might want to examine the following file which should be where all the actual processing is happening:
wpml-string-translation\inc\potx.php
NOTE: I did test with version 4.0.7 of WPML and its version at the time of String Translation and it still does not scan HAML files.
Once you go to WPML->Themes and Plugins localization-> Scan your theme and then you get a list of all the files scanned, only .php files are scanned.