Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs: translate key missing quotes #572

Merged
merged 1 commit into from
Apr 16, 2020
Merged

Conversation

drmzio
Copy link
Contributor

@drmzio drmzio commented Apr 16, 2020

Just spent a good hour trying to figure out why the translate key wasn't outputting the translated text. The translate key must be in quotes when calling it inside the translate twig filter. 👍

@mjauvin
Copy link
Contributor

mjauvin commented Apr 16, 2020

site.name is a variable here, it should not be quoted. The next example shows a string key.

@mjauvin mjauvin closed this Apr 16, 2020
@drmzio
Copy link
Contributor Author

drmzio commented Apr 16, 2020

@mjauvin Are you sure about that? Just checked site and site.name and they're never declared as variables anywhere. The example provided in the docs reference the site.name key in the theme.yaml

translate:
    en:
        site.name: 'My Website'
        nav.home: 'Home'
        nav.video: 'Video'
        title.home: 'Welcome Home'
        title.video: 'Screencast Video'

The only way to pull the values is by calling {{ 'site.name'|_ }} in quotes.

@mjauvin
Copy link
Contributor

mjauvin commented Apr 16, 2020

If it is referring to that key in the theme translation, then you are correct. My appology.

@mjauvin mjauvin reopened this Apr 16, 2020
@mjauvin mjauvin added this to the 1.6.11 milestone Apr 16, 2020
@mjauvin mjauvin merged commit dd179d6 into rainlab:master Apr 16, 2020
@drmzio drmzio deleted the patch-1 branch April 16, 2020 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants