Language translation of a website

does PHP offer resources for this purpose you guys? I know wikipedia does this, by using what seems to be, subdomains or something that seems like subdomains. for instance, this page is in russian:

https://ru.wikipedia.org/wiki/PHP

but if you are in the USA and go to that PHP page after a search, they automatically detect your location and point you here:

https://en.wikipedia.org/wiki/PHP

I can easily get my hands on all the ISO language codes needed, but I’m not sure if I should do this the wikipedia way or purchase a service like google’s Cloud-based Translation API, which costs $45 USD per month after a free trial. I never use a large company’s service if I can help it, because I know darn good and well that their engineers are not paying attention to detail and are only after the money. I’ve fixed countless problems for business people who have bought software services from large corporations without being informed of the little nuances that the engineers did not take into account before writing the service-based application.

I’ve already looked this up and got a few good pieces of info:
https://tympanus.net/codrops/2009/12/30/easy-php-site-translation/
https://www.sitepoint.com/using-google-translate-api-php/

However, I would like opinions from the PHP experts. Can any of you offer anything in addition to what I already have? thanks!

Depends what you actually need. The way I have seen this done most frequently is a file or data table with the string values of various supported countries. Depending on the domain, something like Google Translate is not sufficient or recommended, legal for instance.

what do you mean goog translate is not sufficient? are you saying that legal firms’ websites usually have language on them too sophisticated for google to figure out and translate? if so, my site is not complex and google will be able to translate it, no problem. thing is, I never pay large companies for any service. I always go with open source alternatives because they are more reliable, built by intelligent people. if I DO store the ISO strings in a data table like you say, what medium do I use to actually translate the information if I can’t use google? are you saying I would have to store the entire text of each webpage in a LONG TEXT field in the mysql database and print it out on the page when the time comes in the script/html?

Legal and medical verbiage has to be precise and you cannot rely on an automatic translator, you hire someone for that.

You store parts, not the entire page. The other thing with multinational sites is the other small changes. Date and money formatting is different, images have to be verified to be acceptable. There are size differences in the text itself.

Sponsor our Newsletter | Privacy Policy | Terms of Service