rainlab / translate-plugin

Enables multi-lingual sites
Other
125 stars 88 forks source link

How can I add translatable fields in theme.yaml #460

Closed shakogele closed 5 years ago

shakogele commented 5 years ago

Hi! II have fields in theme.yaml however I want to make these fields translatable, I'm using Rainlab.Translate plugin in my project. Thanks

w20k commented 5 years ago

Have you read docs? -> https://octobercms.com/plugin/rainlab-translate

shakogele commented 5 years ago

Sure, and whats your point?

w20k commented 5 years ago

It's one option: https://github.com/rainlab/translate-plugin#message-translation Second add as lang pack with your plugin (example: https://github.com/OFFLINE-GmbH/oc-mall-theme, https://github.com/OFFLINE-GmbH/oc-mall-plugin).

w20k commented 5 years ago

Github issues really aren't the place for questions like this. Please use one of the many other avenues available instead of submitting new issues for your questions.

Forum: https://octobercms.com/forum StackOverflow: https://stackoverflow.com/questions/tagged/octobercms IRC: #october on Freenode or https://octobercms.com/chat Slack: https://octobercms-slack.herokuapp.com/

shakogele commented 5 years ago

I think you did not undestand my point. I have fields in theme.yaml like this: my theme.yaml `

name: Blank
description: ''
author: ''
homepage: ''
code: ''
form: config/fields.yaml

and my config.yaml

tabs:
    fields:
        sitename:
            label: Название сайта
            type: text
            span: left
            default: something
            tab: Основные настройки
        logo:
            label: Логотип
            type: mediafinder
            mode: image
            comment: Рекомендуемый размер 250*50px
            span: right
            tab: Основные настройки
        site_subtitle:
            label: Подзаголовок сайта
            type: text
            span: left
            default: sds
            tab: Основные настройки

` I want to make these fields translatable

shakogele commented 5 years ago

Github issues really aren't the place for questions like this. Please use one of the many other avenues available instead of submitting new issues for your questions.

Forum: https://octobercms.com/forum StackOverflow: https://stackoverflow.com/questions/tagged/octobercms IRC: #october on Freenode or https://octobercms.com/chat Slack: https://octobercms-slack.herokuapp.com/

I already submitted my question there and did not got answer

w20k commented 5 years ago

Directly in theme, I've already posted a single solution. if you have a plugin for a theme - different story.

Add lang dir and use it as a key in your config.yaml example: https://github.com/OFFLINE-GmbH/oc-mall-plugin/blob/develop/lang/ru/frontend.php#L23

sitename:
            label: 'offline.mall::frontend.form.password_repeat' //author.name::translate.key

If you have only theme and want to translate within it:

name: My Theme
# [...]

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

Should be the key to use: site.name, if I'm not mistaken.

w20k commented 5 years ago

Like this: https://github.com/lovata/oc-bootstrap-shopaholic-theme/blob/master/config/fields.yaml

roojai commented 4 years ago

I am also stuck with this. I understand the question - how do we make configurable options in our config/fields.yaml

mjauvin commented 4 years ago

Please, see https://github.com/rainlab/translate-plugin/pull/559

roojai commented 4 years ago

Thanks!