BoltTranslate / labels

Bolt Labels extension - Translatable labels for Bolt
https://bolt.cm/
18 stars 12 forks source link

Set the right language on $lang variable #59

Closed nestordedios closed 6 years ago

nestordedios commented 6 years ago

In twigL($label, $lang = false) $lang default value is false.

If no lang value has been passed when calling {{ l("label-name") }} then try to fallback to the current language or if no current language is set then fallback to the default language set in the 'labels.config.yml' file.

This is important when this line https://github.com/bolt/labels/blob/master/src/LabelsExtension.php#L182 gets executed.

$savedLabel won't get the right value if $lang variable is not a language. Which might try to add a label when it already exists.

This fixes the issue where labels are removed from labels.json when accessing a 404 error page.

bobdenotter commented 6 years ago

Looks good to me!