Как перевести текстовое поле на 2 языка woocommerce - PullRequest
0 голосов
/ 17 мая 2019

У меня есть текстовое поле, которое я не могу перевести на второй язык с помощью wpml. Поэтому я хочу внести в свой код поправку для этого.

Я обнаружил, что использую "ICL_LANGUAGE_CODE", но я не уверен, как использовать его для массивов. Использование, как показано ниже, ничего не меняет, по-прежнему отображая греческий текст для обоих языков.

    public function product_settings_fields() {
        echo '<div id="fees_product_data" class="fee_panel panel woocommerce_options_panel wc-metaboxes-wrapper">';
        echo '<div class="options_group">';


    if(ICL_LANGUAGE_CODE=='en') {// Text Field - Fee Name
        woocommerce_wp_text_input( array( 
        'id' => 'product-fee-name', 
        'label' => __( 'Recycling Tax', 'woocommerce-product-fees' ), 
        'data_type' => 'text', 
        'name' =>__( 'product-fee-name'), 
        'value'=>__('Recycling Tax'), 
        'placeholder' => __('Recycling Tax', 'woocommerce-product-fees'), 
        'desc_tip' => 'true', 
        'description' => __( 'This will be shown at checkout descriping the added fee.', 
        'woocommerce-product-fees' ) ) );

        // Text Field - Fee Amount
        woocommerce_wp_text_input( array( 
        'id' => 'product-fee-amount', 
        'label' => sprintf( __( 'Fee Amount (%s)', 'woocommerce-product-fees' ), get_woocommerce_currency_symbol() ), 
        'data_type' => 'price', 
        'placeholder' => __('Monetary Decimal or Percentage', 'woocommerce-product-fees'), 
        'desc_tip' => 'true', 
        'description' => __( 'Enter a monetary decimal without any currency symbols or thousand seperators. This field also accepts percentages.', 'woocommerce-product-fees' ) ) );}

        do_action( 'wcpf_add_product_settings_group_one' );

        echo '</div>';
        echo '<div class="options_group">';

    else(ICL_LANGUAGE_CODE=='gr'){woocommerce_wp_text_input( array( 
        'id' => 'product-fee-name', 
        'label' => __( 'Εισφορά Ανακύκλωσης', 'woocommerce-product-fees' ), 
        'data_type' => 'text', 
        'name' =>__( 'product-fee-name'), 
        'value'=>__('Εισφορά Ανακύκλωση'), 
        'placeholder' => __('Εισφορά Ανακύκλωση', 'woocommerce-product-fees'), 
        'desc_tip' => 'true', 
        'description' => __( 'This will be shown at checkout descriping the added fee.', 
        'woocommerce-product-fees' ) ) );

        // Text Field - Fee Amount
        woocommerce_wp_text_input( array( 
        'id' => 'product-fee-amount', 
        'label' => sprintf( __( 'Fee Amount (%s)', 'woocommerce-product-fees' ), get_woocommerce_currency_symbol() ), 
        'data_type' => 'price', 
        'placeholder' => __('Monetary Decimal or Percentage', 'woocommerce-product-fees'), 
        'desc_tip' => 'true', 
        'description' => __( 'Enter a monetary decimal without any currency symbols or thousand seperators. This field also accepts percentages.', 'woocommerce-product-fees' ) ) );}

        do_action( 'wcpf_add_product_settings_group_one' );

        echo '</div>';
        echo '<div class="options_group">';

Я хочу выполнить для греческого языка текстовое поле должно отображать текст на греческом языке, а для английского языка текст должен отображаться на английском языке.

Заранее спасибо!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...