Is there some way to create sections inside static translations? (craft v3) At the moment I'm converting a website from a different CMS to Craft v3. The 'old' CMS had a convenient way to set a hierarchy for static translations in yaml files so that we could split translations into groups per section on the website.

Like this:

  PageNavigation:
    PrevPage: 'Previous'
    NextPage: 'Next'
    GotoPrevPage: "Goto previous page: '{prevPageTitle}'"


Now I can't find anything like that on the documentation and google search on Craft CMS. At the moment this is what I got instead:

&lt;?php

return array(
    'PageNavigation.PrevPage' =&gt; 'Previous',
    'PageNavigation.NextPage'=&gt; 'Next'
    'PageNavigation.GotoPrevPage' =&gt; "Goto previous page: '{prevPageTitle}'"
);


So every translation-item has a group supplied to it as a prefix, followed by a dot and then the translation-itemID. But this gets ugly soon and is not as convinient as what I was used to in the other CMS.

1)
Does anybody here perhaps knows if CraftCMS has a better way of setting hierarchy to static translations? So to group translation items to sections/elements on the website?

2)
Is there a way in Craft CMS to have a placeholder inside the translation-string being replaced by a variable inside the template?

In the 'old' CMS I could replace a placeholder like {placeholder} inside a translation-string by a dynamic variable inside the template. So a translation string like "Goto previous page: '{prevPageTitle}'" would come out as "Goto previous page: 'all about craft blog title'". Is there some functionality build in Craft that could replace a placeholder in the translation-string by a dynamic string?

Thanks in advance!!
You can include custom translation categories within your config/app.php

return [
    'modules' =&gt; [
        'my-module' =&gt; \modules\Module::class,
    ],
    'components'    =&gt; [
        'i18n' =&gt; [
            'translations' =&gt; [
                'foo'  =&gt; [
                    'class'            =&gt; \craft\i18n\PhpMessageSource::class,
                    'forceTranslation' =&gt; true,
                    'basePath'         =&gt; '@translations',
                ],
            ]
        ]
    ]
    //'bootstrap' =&gt; ['my-module'],
];


This will include the custom group foo to your app, make sure to change the basePath variable to a path you like

That being said your folder structure will look like

-your base path
|-- en-US
|-----&gt; foo.php
|-- de-DE
|-----&gt; foo.php


within these files you can create your custom translations

return [
    'foo' =&gt; 'bar'
];


{{ 'foo'|t('foo') }} -&gt; will now display bar
{{ 'foo'|t('site') }} -&gt; will still show foo