phdphd Posted June 22, 2012 Share Posted June 22, 2012 Hi All, I want my site to be available in different languages and wonder whether there exists a utility that helps extract from HTML/PHP code all the strings that are likely to be displayed to the user. This will be very helpful when entering the translation process. Any idea or clue ? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/264617-extracting-strings-from-htmlphp-code-for-multilingual-site/ Share on other sites More sharing options...
SurrealScripts Posted June 25, 2012 Share Posted June 25, 2012 Not quite sure on what you're meaning here but you could always store your content in a database and then just echo the content onto the page. Normally what I do for my sites to simplify everything but I'm really not sure on what you want here sorry. Quote Link to comment https://forums.phpfreaks.com/topic/264617-extracting-strings-from-htmlphp-code-for-multilingual-site/#findComment-1356760 Share on other sites More sharing options...
phdphd Posted June 25, 2012 Author Share Posted June 25, 2012 Hi, Let me rephrase my question. Imagine you developed a long time ago a website for a local audience, and that given its great success you decide to target it to other audiences in other countries. Is there a utility that enables to extract all translatable strings before sending them for translation ? "All" means extracting for example "My Website" from <title>My Website</title> but also from echo 'My Website'; of from echo $a .'My Website'. $b; Quote Link to comment https://forums.phpfreaks.com/topic/264617-extracting-strings-from-htmlphp-code-for-multilingual-site/#findComment-1356877 Share on other sites More sharing options...
Mahngiel Posted June 25, 2012 Share Posted June 25, 2012 You're going to have to write a function that sends the text to a translator and return those results. Then before your outputs, you have to determine the location of the user (typically by IP address) and run it through your function with the language you're estimating it is. The best thing to do is grab a majority of the most commonly spoken languages and use those for people to select from if your search fails or returns illegible. Of course, you'll need native speakers to validate some of the returns before you can trust your source. Furthermore, you'll likely want to purchase domains in their locale (.co.uk, .it, .ru, etc etc) and redirect automatically with a preferenced language preset. Quote Link to comment https://forums.phpfreaks.com/topic/264617-extracting-strings-from-htmlphp-code-for-multilingual-site/#findComment-1356878 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.