-
-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translating with HTML #23
Comments
Yes, this is a problem with Google Translate itself. I guess you can write a regex (or just |
You should do it with regex as the space is after |
Any examples? It really misses up everything... On Thu, May 14, 2015 at 8:03 PM, Levan Velijanashvili <
Steward Godwin Jornsen In His Name Bible Church This mail should only be used for the purpose of which it was sent and by |
$result = $t->translate('html string here');
$result_with_correct_html = preg_replace('/\/\s/', '/', $result); That's it. |
Thank you very much. I shall give that a try. If that works great, you Thanks again. On Wed, May 20, 2015 at 11:00 AM, Levan Velijanashvili <
Steward Godwin Jornsen In His Name Bible Church This mail should only be used for the purpose of which it was sent and by |
I really appreciate your idea, but I don't think so. This package has a very simple API - just three methods and that's it. This is not intended to translate HTML strings. If so, then why not add JSON or XML support? It will lead to very impure code. Bringing back HTML tags is one simple regex (noted above). It's not worth adding extra functionality for that. Plus, I'm not sure this regex will fix all problems with translated HTML. P.S I won't close this issue for now. Let it be open for further public discussions. |
The official paid API has So if we could find any way* to make it work with HTML strings without damaging tags and avoiding usage of extra "hacky" regexes, it would be really cool. * - Maybe it can be achieved using some attribute in URL string. The actual translate.google.com doesn't have option to set type to HTML, so I'm not sure we can find an easy solution for this |
Thanks, Steward On Thu, May 21, 2015 at 1:01 AM, Levan Velijanashvili <
Steward Godwin Jornsen In His Name Bible Church This mail should only be used for the purpose of which it was sent and by |
That's exactly what I mean "without damaging tags". Yea, I think there's no way to translate HTML using this service url. |
Can you make autoload versions ?. There i using hosting. Not supported for installing new php library |
The official API has way better support for html tags. When reverse engineering the current inline translation of Google Chrome, these results are also very good (and with correct html tags). I've extracted the following parameters, Google Chrome currently uses: Can anybody check if some parameters are missing in this library? |
Please help me regex replace: class = "row" => class="row" |
bro you can use this to translate your html database data to any language using this package. {!! \Stichoza\GoogleTranslate\TranslateClient::translate( Session::get('s_lang'), Session::get('t_lang'), html_entity_decode(str_limit($n->body,500) ) ) !!} |
the paid API also allows
yes, it was not easy ^^ but i got it working in my translate.js script |
Thanks for the translator script. I think the issue is more with Google than with your script. if html is translated, ends up as </ li> which isn't right. So one can't translate an article that has paragraphs and html elements without it breaking. So my question is more of a tip:
Can I possibly translate html without damaging the html codes? If yes, how? Any suggestion is appreciated.
The text was updated successfully, but these errors were encountered: