Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

128
Vistas
Wordpress how to translae acf plugin fields to another language?

I need to translate Choose File & No file chosen to another language (Japanese).

The following code is from acf field.

I looked into the code but there are no Choose File & No file chosen.

Would you please let me know how to translate them in this case?

enter image description here

<div class="acf-input">
<div class="acf-file-uploader" data-library="all" data-mime_types="" data-uploader="basic">
    <input type="hidden" name="acf[field_60bc51d8898c5]" value="" data-name="id">   <div class="show-if-value file-wrap">
        <div class="file-icon">
            <img data-name="icon" src="" alt="">
        </div>
        <div class="file-info">
            <p>
                <strong data-name="title"></strong>
            </p>
            <p>
                <strong>File name:</strong>
                <a data-name="filename" href="" target="_blank"></a>
            </p>
            <p>
                <strong>filesize:</strong>
                <span data-name="filesize"></span>
            </p>
        </div>
        <div class="acf-actions -hover">
            <a class="acf-icon -cancel dark" data-name="remove" href="#" title="Delete"></a>
        </div>
    </div>
    <div class="hide-if-value">     
        <label class="acf-basic-uploader">
            <input type="file" name="acf[field_60bc51d2899c5]" id="acf-field_60bc51d2899c5">
                               </label>             
    </div>
</div>
</div>



Thank you.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

If you want to translate just a handful of words and not the entire plugin, then you could use the following method!

So, every well-developed plugin/theme has a text domain associated with it, so that you could hook into it and manipulate any text generated by that plugin/theme. For example text domain for woocommerce plugin is woocommerce! For ACF plugin, it's acf!

Usually you could find the text domain in the main file of the plugin. For ACF plugin you could find it in the acf.php located in the root directory of the plugin. See the screenshot below!

enter image description here

After you found the text domain then you could hook into it using gettext, ngettext etc. filter hooks! See the code below:

add_filter('gettext', 'your_theme_translate_acf_fields', 20, 3);

function your_theme_translate_acf_fields($translated, $text, $domain)
{
  if ('acf' == $domain) :
    switch ($translated) {
      case 'No file chosen': // THIS IS THE TEXT GENERATED BY THE ACF PLUGIN
        $translated = 'ファイルが選択されていません';
        break;
      case 'Choose File': // THIS IS THE TEXT GENERATED BY THE ACF PLUGIN
        $translated = 'ファイルを選ぶ';
        break;
    }
  endif;

  return $translated;
}

Notice: Capitalization matters!

Code goes to your functions.php of your active theme. Tested and works!

Wordpress translation filter hooks:
gettext
ngettext

over 4 years ago · Santiago Trujillo Denunciar

0

If you want to translate any plugin first, check the .pot file. The file is inside wp-content>plugins>plugins-name>languages. You can edit the file with POedit. You can translate to any language.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda