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?
<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.
2
Answers
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.
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 exampletext domain
forwoocommerce
plugin iswoocommerce
! ForACF
plugin, it’sacf
!Usually you could find the
text domain
in the main file of the plugin. ForACF
plugin you could find it in theacf.php
located in the root directory of the plugin. See the screenshot below!After you found the
text domain
then you could hook into it usinggettext
,ngettext
etc.filter hooks
! See the code below:Code goes to your
functions.php
of your active theme. Tested and works!