Translation PHP or JS

Asked

Viewed 375 times

1

I have a page where I must translate. At first I had thought of translating with JS, to do something dynamic, IE, the person would click the button, I would call a file . json and perform translation.

But then I found the library php-gettext, that does what you want to do, but passing the parameter through the URL, as I use iframe, complicates the manual change to the language the person wants, in the given situation.

I tested the library and it works well, and the important thing there is the poedit program that facilitates translation. But I have a problem, I once do new updates. That way I will have to update the main files and the others.

1º - There is some button in poedit for me to update the whole file . pot, without losing the existing functionalities, as well as the . type of translations already carried out?

*Checking poedit, it has an option where I can update the file . po through the updated . pot, without losing the translations performed.

2º - If not, what indication would you make so that I can translate my site, what do you think of the option with javascript. Find viable?

3º - Is there any easier way?

1 answer

1

You can create a . POT file by Poedit itself to keep as the main "catalog". The cool thing is that by the program itself you can make it sift through the source code behind the new terms in the source code. From there, you can always update your file. PO from the . POT, which keeps all the translations you have already performed.

I believe this is a very efficient way to internationalize any application in PHP.

  • The good, which in addition to updating the file .pot... it updates the file . po without losing existing translations, they stay in the program database. My fear is about how much more memory, processing, internet... will occupy doing this procedure?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.