PHP files: Translate HTML if written from echo or other PHP commands
We received a question for translating PHP code.
Although this PHP looks as if it is an HTML page, it is actually not:
<?php
echo "<div class='prod'>
<div class='prodImg'><img src='products/graphic-panel.jpg' alt='Graphic Panel with a Logo' title='Graphic Panel'/></div>
<div class='prod2'>
<h5>Additional Products and Accessories</h5>
As you can see the HTML code is emitted by the "echo" command...
What is thus needed is to instruct Wordbee to extract quoted code for translation. To get any code translated, tick the option below in the config:
This will extract ALL code strings for translation - not necessarily something you want. To fine-tune code extraction, do not tick the option but instead add regulare expressions further down to extract just the specific PHP code.
Finally, there is no means to get Wordbee interprete the code as HTML. It will show up as raw HTML without markup protection.
Enjoy,
Stephan
-
Follow up: If you use regex to only extracts quoted string content if it "looks" like HTML, you would proceed similar to this:
Here we only translate quoted text if it contains a <ul> markup:

Then the entire HTML block is extracted for translation (and not just a portion!) because it contains a <ul> tag.
Stephan0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar