Hello,
I have just translated the .pot
file to German.
Then I tried to add the new de_DE.po
file to child_theme/lib/languages/de_DE.po
, but that is not wokring. The translation only works if I add the file to /tm-beans/lib/languages/de_DE.po
.
Is there a way to add the translation file to the child theme, that it will not be lost on every update?
Even better would be to store the files in /wp-content/languages/themes
.
Thanks, Jochen
Hi Jochen and welcome to Beans Community,
Beans doesn't dictate where you should add your translation but indeed let you define it yourself using the load_child_theme_textdomain()
function in your child theme functions.php
. To have your translation files .po
and .mo
in your child theme languages/
directory, you would add the following in your child theme functions.php
:
load_child_theme_textdomain( 'tm-beans', get_stylesheet_directory() . '/languages/' );
load_child_theme_textdomain()
first argument must be tm-beans
as it is Beans text domain used for translation. The second argument is the path to your directory containing your translation files, you may change it according to your preference and need.
Happy coding,
Thank you.
I can contribute the German language files, if you plan to include it into the source.
Hi Jochen,
Thanks for offering your contribution which will definitely be super useful in a little while.
Quite a few people have offered translation but we haven't quite put a solid workflow in place for a simple reason. Beans has been submitted to WordPress.org which means if to goes through, translations would be handle there. It is about a month away from being reviewed (hopefully) so we don't want to re-invent the wheel and build an entire translation workflow unnecessarily.
That said, they are chances of Beans not being added onto WordPress.org depending on what needs to change. WordPress.org is quite limiting and usually push for simple and conventional themes and we certainly don't want to remove features out of Beans just to be added on WordPress.org, in which case we would build our own translation workflow π
So it should all be setup within a month or two depending on how fast the review goes on WordPress.org.
Oh, I was already looking on wordpress.org, to find Beans π
But having Beans on wordpress.org would help to spread the theme to the world.
Yes it would be a massive achievement and most probably the first theme of this kind to be on .org π
That said we are not prepared to comprise on the quality and what Beans offers just to be on .org, so we will have to wait and see!
I would gladly add my translation Beans to Polish π I have *.mo and *.po files made with Loco Translate plugin.
Give a shout when its time for Dutch, both .mo and .po ready π
Hi!
I installed the loco translate plugin, too. I translated most of the frontend terms to portuguese. Loco outputed the files pt_PT.mo and po. But I see no changes. The terms I translated using the plugin still in english. What am I missing?
Have you followed the instructions of Thierry? See: https://community.getbeans.io/discussion/add-translation-files-to-the-child-theme/#post-605
Yes, Jochen, I did. I moved the loco files to a directory called languages, inside the child theme. I inserted the code:
// path to translation //
load_child_theme_textdomain( 'tm-beans', get_stylesheet_directory() . '/languages/' );
in my functions.php (actually in the plugin for child themes modifications from theme butler, where I always do). I changed most of the site front end terms to my language. And nothing happened...
Hey Sami,
That is odd, the code you posted to register your translation is correct. I would think there might either be a spelling mistake in your languages
folder name, files name or in your files translation content.
Could you may upload your translation files using Cloudup and share the link so that we can test it too?
Thanks,
All right,
Here is the link: https://cloudup.com/cnbGMJ_9nXG
Thanks for the support.
By the way: whenever you want, for the next release, you can use my translation files, too, if you wish. Just tell me, so I can finish the translation (I only translated the frontend terms yet).
Cheers
Hi!
Did you take a look at the translation files in cloudup?
The problem remains...
Thanks.
Hey Sami,
I looked into your files, it only has the header and don't contain any translation. Please make sure to add translation for all the Beans strings π
Happy coding,
Hi Thierry,
Yes, the .po file there is empty. My mistake on sending the folder before the changes I made.
After that, I copied the contents from the backup and added it to the actual .po file. Still not working after that.
I'm sending the correct version of the file now.
https://cloudup.com/cEQiDz4JUWP
Thanks for your help Cheers
Hey Sami,
The .po
file is correct but you are still missing the .mo
. I used your .po
file to recompile .mo
which you can download here. When adding both in a child theme it works fine on my side.
Have fun,
Hi Thierry,
You're awesome! Thank you!
I thought it only needed the .po.
Cheers
Hi, I'm new to Beans. I translated the file to German, uploaded both po and mo files to my child themes 'lib/languages' folder and put the line
load_child_theme_textdomain( 'tm-beans', get_stylesheet_directory() . '/lib/languages/' );
into my functions.php. It is still showing the english translation on the website. What am I doing wrong? https://ribosear.ch/was-sind-mitochondrien-und-was-machen-diese/
thank you, karen