【问题标题】:Wordpress widget php file is not translatable with PO filesWordpress 小部件 php 文件不能用 PO 文件翻译
【发布时间】:2021-10-16 01:45:00
【问题描述】:

谁能帮我解释一下为什么 php 中的这些字符串是不可翻译的? 我应该如何更改代码,以便可以使用 PO 编辑翻译“Jhon”和“Doe”占位符?

        'first_name_input'    => [
            'type'        => 'text',
            'name'        => 'first_name',
            'id'          => 'first_name' . esc_attr( $id ),
            'placeholder' => ($settings['first_name_placeholder']) ? $settings['first_name_placeholder'] : 'Jhon',
            'class'       => [
                'first_name',
                'bdt-input',
                'bdt-form-' . $settings['input_size'],
            ],
        ],
        'last_name_input'     => [
            'type'        => 'text',
            'name'        => 'last_name',
            'id'          => 'last_name' . esc_attr( $id ),
            'placeholder' => ($settings['last_name_placeholder']) ? $settings['last_name_placeholder'] : 'Doe',
            'class'       => [
                'last_name',
                'bdt-input',
                'bdt-form-' . $settings['input_size'],
            ],
        ],

非常感谢。

【问题讨论】:

    标签: php po


    【解决方案1】:

    这和<input type='text'.... placeholder='anything here'>类似

    所以你不能真正直接翻译它,因为你实际上会改变编程参数,但回答你的问题,我认为它会解决问题:

    'placeholder' => ($settings['first_name_placeholder']) ? $settings['first_name_placeholder'] : 'Your Name'

    'placeholder' => ($settings['last_name_placeholder']) ? $settings['last_name_placeholder'] : 'Your Last Name'

    把“你的名字”和“你的姓氏”改成你想要的就行了:)

    【讨论】:

      猜你喜欢
      • 2017-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多