News:

At Osclass we have changed our Privacy Policy and Terms of Use in order to adapt them to the new General Data Protection Regulation (GDPR). We want you to know what user data we store, what we need them for, and who we share them with in each specific case. Furthermore, we are making it even easier for you to exercise your right to manage your own data.

Our goal is that you enjoy the best possible experience with our website. As the GDPR comes into force, legislation requires us that you grant us permission—both to us and our partners—to store cookies in your browser. Remember you can find more information about what we do with your data by clicking here.

For the static content I know I have to create the translation file, but I-m talking about dynamic content, like in the listing section.every time you add a new language, in the listing section appears a new tab with the corresponding language where you can translate the content.

how can I replicate this? I have an idea how to show the form and the tabs, but once it's saved in the db,

I don't know if osclass has a specific function to select the current language, and show it.

Here's an idea for you if you want to skip the whole vanilla mechanism for translations:

The main translation function __($key, $domain = 'core') in oc-includes/osclass/helpers/hTranslations.php returns a string using a filter "gettext", so you can intercept that string and change it according to your needs:

If you are trying to build a standard mechanism for plugin translations, I have to warn you that my idea is nothing but a hack that I proposed here thinking only of a single plugin using it. This method would work only after the normal translation process is performed, so it would add an overhead (more time).

I'd explore other angle: Given the fact that you would have to set some kind of interface to set translations anyway, why not store the results on a regular .po file and use something like this to convert to .mo?

thanks again teseo, that's a better way to solve this problem, I asked because in the listing section it's already implemented, so I imagined that could be some oficial function to do it, I'll look inside of the admin file to check how it's implemented there, if I don't get anything specific I will try with that php-mo function who is very easy to use!