How to translate custom field labels for different admin users languages ?
Support › General › How to translate custom field labels for different admin users languages ?Resolved
- This topic has 19 replies, 2 voices, and was last updated 3 years, 1 month ago by
sofdesigne.
-
AuthorPosts
-
February 13, 2022 at 6:35 PM #33880
sofdesigne
ParticipantHi, i want to trasnlate all my custom fields labels to another language in addition to the current language,
can you please tell me how to do that ?
i tried locotranslate but i can't find custom fields labels !also i need to translate list choices, group labels and buttons
and switch labels and on off status labelsthank you
February 14, 2022 at 4:37 PM #33891Long Nguyen
ModeratorHi,
You can add the code that creat the custom field to the theme, change the text-domain to theme's text-domain. Then edit the file template POT in Loco Translate, sync with the new scan to translate the field name. Here is an example:
$meta_boxes[] = [ 'title' => __( 'User meta 2', 'estar' ), 'id' => 'user-meta-2', 'type' => 'user', 'fields' => [ [ 'name' => __( 'Text123', 'estar' ), 'id' => $prefix . 'text_ay5g5lcx88c', 'type' => 'text', ], ], ];
February 14, 2022 at 6:19 PM #33894sofdesigne
ParticipantThank you for your response,
i couldn't acheive this i don't know where i am not doing it right- i edited the theme POT file right ? like this
https://ibb.co/KL5Z1d2
https://ibb.co/HCGX6gH
but when i sync nothing happens, can't find any word
https://ibb.co/YdX0Skh
i am using oxygen builder
thanks
February 15, 2022 at 12:35 PM #33905Long Nguyen
ModeratorHi,
When editing a language, you also need to click "Sync" to update new strings from the POT file. Here is the demo https://monosnap.com/file/y7s1CGPchopz2baTeMCrlzYrEk9ODE
February 15, 2022 at 8:34 PM #33914sofdesigne
ParticipantThanks,
i tried everything without a success, i don't know what to do ! and why it didn't work !
btw: can i choose another text_domain like meta-box for example or meta-box-aio ? why it needs to be on the theme ?
because i suspect that the theme selected is managed by oxygen builder and maybe there is a conflict in this matter, what do you think, what you can do to try to troubleshoot this issue if you have a same case ?
thanks for your help
February 15, 2022 at 10:02 PM #33917sofdesigne
ParticipantI tried that on a new fresh website
same thing, i can't get it to work !https://ibb.co/9V9cvJ2
https://ibb.co/9YNFLk7
https://ibb.co/68qpcST
https://ibb.co/X4WzD15i have no idea why it's not working, even on a fresh website without oxygen builder and using the free metabox version
if you want i can give you an access if you can help, thanks a lot
February 15, 2022 at 10:06 PM #33918sofdesigne
Participantthe field is on the hello world post
https://ibb.co/HHngbSgFebruary 16, 2022 at 11:18 PM #33946Long Nguyen
ModeratorHi,
You can share your site credentials via this contact form https://metabox.io/contact/, I will help you to check this issue.
February 16, 2022 at 11:32 PM #33950sofdesigne
ParticipantThanks a lot,
i just sent you 2 emails
February 17, 2022 at 10:27 AM #33952Long Nguyen
ModeratorHi,
Can you please check the word
User Meta 2
added to the theme? It is translated as well.February 17, 2022 at 5:17 PM #33962sofdesigne
ParticipantHi, thanks a lot Long, really appreciate it
Can you explain why my version didn't work ? what i did wrong ?thanks
February 18, 2022 at 5:04 PM #33982Long Nguyen
ModeratorHi,
I'm not sure. Can you please share the code that you run on your site? I've just removed it to test. You can generate the standard code from Online Generator or Builder to translate.
February 18, 2022 at 5:10 PM #33983sofdesigne
ParticipantI replaced your code with mine and it worked fine, have you done something other than the steps you showed me first time ?
can't figure out why my version is not working even with same code !
sorry again for bothering, i can't progress because of this
February 19, 2022 at 9:53 AM #33998Long Nguyen
ModeratorNothing more. I've just re-synced the template file POT to get new strings. Then re-sync the language template with the POT file to start translating 🙂
February 19, 2022 at 6:33 PM #34009sofdesigne
ParticipantHi Long
thanks again for your assistance, really appreciate iti did some deep testing and here is what i found:
when using the code generator and putting the code into themes functions.php, it will work like your example.
this way it's hard coded and loco translate can see the codebut in my case i use the builder, so i don't put code on functions.php !
so i think it's on the database, and loco translate can't see it !
i downloaded my whole website and i can't find any custom field names or labels there ! of course because there is nothing inside functions.phpif this is right, and seems logical to you, how would you deal with this situation ?
thanks again
- i edited the theme POT file right ? like this
-
AuthorPosts
- You must be logged in to reply to this topic.