medienbaecker / kirby-modules

Plugin for modular Kirby websites
MIT License
73 stars 7 forks source link

Add fallback translation back #23

Closed pedroborges closed 3 years ago

pedroborges commented 3 years ago

Without the fallback translation, the text defined on the section headline in the blueprint is never used.

medienbaecker commented 3 years ago

I changed this because I found an English fallback for non-translated languages to be better. If you provide a fallback, the variable modules.empty is used instead of the English translation:

'empty' => function ($empty = 'modules.empty') {
  return I18n::translate($empty, $empty);
}
Screenshot-30-09-2020_11-54-50@2x
'empty' => function ($empty = 'modules.empty') {
  return I18n::translate($empty);
}
Screenshot-30-09-2020_11-54-28@2x

I would suggest using something like this to make sure you can overwrite it in the blueprint but still have the English fallback:

'empty' => function ($empty = null) {
  return $empty ? $empty : I18n::translate('modules.empty');
}

What do you think, @pedroborges?

pedroborges commented 3 years ago

@medienbaecker Totally makes sense, I have updated my PR.