How to translate strings programatically
-
Hello Team,
I’m writting a custom theme for a client and I’m using TranslatePress for translations, but they have a custom role for handling specific things (this is a menu for restaurants, so they have roles for editing the specific branch menu) but right now they want to translate on the branch the menus so they don’t need an admin, I know this plugin has the “premium version” which allow us to show the “Translation Editor” on custom roles, but we DON’T want to show the editor, ONLY specific things.
For example, we have a Burguer, so in Spanish it’s:
“Hamburguesa” they want to translate it manually to “Burguer” if there are no translations already.
I know already that we have the
trp_translate
function to show a string translated like “Bebidas” which was already translated to “Drinks”, so that works to print the current translations, but I want to do something like:translate_string($original, $translation)
so it’s saved and on the pages, it start to show, we only want to translate 2 things, and not show anything that the branch managers to know that we’re using WordPressIs that possible? or do I need the premium version or how I can achieve that?…
I already tried the
query
component withinsert
andupdate
functions, but don’t work, and theprocess_strings
needs an already translated string, so I’m not sure if this is even possible… so I hope it is and I’m not watching something. If I need to buy the premium version, please let me know with the attached source that I need to use for this specific code.Thanks in advance!
- You must be logged in to reply to this topic.