-
I am developing with Bizznis.
The translation file en_US.po in child theme master doesn’t have translations ready for e.g. Search text and Breadcrumb text.
How do I do that?
Does there need to be some gettext quotes in the sources files?
Would love to hear your feedback.
OK I did see that the .po file of all text is in Bizznis theme folder under lib/languages.
I can translate the desired text and put an .mo file there.
But what happens when I upgrade Bizznis? Then everything will be overwritten.
I see .po in child theme but there are only a few text strings.
When I put .po from Bizznis in childtheme folder and create a .mo there it doesn’t work either.
I have this in my functions.php for localization:
//* Set Localization (do not remove)
load_child_theme_textdomain( 'weydelandNL', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'weydelandNL' ) );What can I do?
I see your point.
As Bizznis is a parent theme, you can override every file with your child theme, language files included. Here’s what you have to do in order to keep your Bizznis powered website translated even after updates.
- Go to your active child theme folder and create a folder called languages.
- Upload your translation files (your .mo and .po files) to the languages folder you just created.
- Next up, we need to tell Bizznis we want it to look for translation files in your Child Theme folder instead of the Bizznis folder. We need the following code pasted in your Child Theme’s functions.php:
// Child Theme Language override
define('BIZZNIS_LANGUAGES_DIR', STYLESHEETPATH.'/languages');define('BIZZNIS_LANGUAGES_URL', STYLESHEETPATH.'/languages'); - This snippet needs to go before the following code:
load_template( get_template_directory() . '/lib/init.php' );
but after the opening
<?php
That’s it. Now your site will always remain translated. Do keep in mind that a bigger Bizznis update (e.g. from 1.0.x to 1.1) will probably contain new untranslated texts in the new Bizznis .po file found in the /lib/languages/ folder.
Thanks that worked.
But I think there is a bug. I tried to translate the 404.php text in Poedit.
I get this error in Poedit: A format specification for argument 1 doesn’t exist in ‘msgstr’
It’s related to this message string
#: ../404.php:20
#, php-format
msgid ""
"The page you are looking for no longer exists. Perhaps you can return back "
"to the site's homepage and see if you can find what you "
"are looking for. Or, you can try finding it by using the search form below."
msgstr ""
"Helaas, deze pagina bestaat niet. Gebruik het menu op deze pagina om te "
"vinden wat u zoekt. U kunt ook in de zoekbalk hieronder uw zoekopdracht "
"invullen. "I think it has to do with the % symbol in there. Because there is a % symbol in 404.php we get a problem with translation?
Greetings,
Jonathan
Nothing is wrong with the original string itself, but your translated string is missing this in it:
homepage
Add it somewhere in your translation and it should work. Of course, you can translate the ‘homepage’ text, but add the rest of it.
OK thanks. That did the trick.
How do I translate the “Search this website” text in the search bar?
It’s not in the .po files.
I know its in lib/frontend/search.php.
Greetings,
You have a sharp focus :) …
Fixed it and will add it to next theme release. In the meantime, replace this inside lib/frontend/search.php:
esc_attr__( 'Search this website', 'bizznis' )
with this:
__( 'Search this website', 'bizznis' )
In other words, just delete second “esc_attr” on line 15.
OK.
But this have an effect on the .po file in the Bizznis languages folder. I needed to add the string in there, which I did.
I see you already added this to Github, otherwise I would have done it:) Thanks again!
First website on Bizznis is almost ready:) Will send you link when done.
bonjour
comment installer la bar de traduction comme la version demomerci
You must be logged in to reply to this topic.