Hi all.
Just working on a bilingual site with EN/JP and I’m working with using the following to translate buttons, navigation etc on the site that had no page/title affiliation. But it is only showing the JP version when implemented. Any ideas?
<?php echo t('Read more ...', 'もっと読む ...') ?>
Thanks in advance 
I came up with a basic workaround by doing this, if it helps anyone in the future.
<? if($kirby->language() == 'en'): ?>Project partners:<? else: ?>プロジェクトパートナー:<? endif ?>

Hi, and welcome to the forum 
By defining a fallback in the t()
helper (your second argument with the Japanese string), you advise Kirby to render that string unless there is a registered translation for Read more ...
available in /site/languages/en.php
.
The elegant way to deal with this would be to write <?php echo t('Read more ...', 'Read more ...') ?>
and then provide the Japanese translation in your /site/languages/jp.php
file:
<?php
return [
'code' => 'jp',
/* all the other settings for your locale here */
'translations' => [
'Read more ...' => 'もっと読む ...',
/* all your other translation strings here */
]
];
For a more thorough example, see:
Edit: Fixed omission in example, as pointed out by @pixelijn below (thx!)
Note that Read more
is only the translation key. Nothing will be rendered if you don’t provide translations in all languages, unless you set a fallback.
1 Like
Hey @sebastiangreger and @pixelijn, this is what I was trying originally. Unfortunately it was only ever showing the JP translation. This workaround will do for now, but I definitely revisit this method again. Thanks for getting in touch, much appreciated. I’ve been a Kirby user since v 1.0, but not active on here until now 
Maybe we can find out together where you are wrong if you post your /site/language files…