{"id":909,"date":"2025-03-24T14:28:00","date_gmt":"2025-03-24T14:28:00","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/translating-custom-fields\/"},"modified":"2025-04-03T15:24:20","modified_gmt":"2025-04-03T14:24:20","slug":"translating-custom-fields","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/translations\/translating-custom-fields\/","title":{"rendered":"Translating Custom Fields"},"content":{"rendered":"\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-info mb-3\" role=\"alert\"><span class=\"fas fa-info-circle me-2\"><\/span><span class=\"flex-grow-1\">This Doc describes how to translate the custom fields you can configure in the GeoDirectory Settings.<br>If you only use one language on your site, you can still use this process to change some field labels and descriptions that are built-in.<br>Follow the steps below each time you update the custom fields settings on your site with new fields.<\/span><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><em><strong>Translating Custom Fields with POEdit<\/strong><\/em><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Run the DB Translation tool at <strong>GeoDirectory &#8211; > Status &#8211; > Tools &#8211; > DB Text Translation<\/strong> to create the <strong>db-language.php<\/strong> file<\/li>\n\n\n\n<li>Find file called\u00a0<em><strong>db-language.php<\/strong><\/em>\u00a0that you will find in your <em><strong>geodirectory<\/strong><\/em> folder on the server.<\/li>\n\n\n\n<li>Copy all files in the\u00a0<em><strong>geodirectory<\/strong><\/em>\u00a0folder to\u00a0your computer:<br><figure><img loading=\"lazy\" decoding=\"async\" sizes=\"auto, (max-width: 572px) 100vw, 572px\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-xVfZ4Qsz66.png 572w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-xVfZ4Qsz66-300x173.png 300w\" width=\"572\" height=\"330\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-xVfZ4Qsz66.png\" alt=\"\"><\/figure><br><\/li>\n\n\n\n<li>Open the\u00a0<strong>\/wp-content\/plugins\/geodirectory\/geodirectory-languages\/geodirectory-en_US.po<\/strong>\u00a0file with <a href=\"https:\/\/poedit.net\/\" target=\"_blank\" rel=\"noopener\">poEdit<\/a>:\u00a0<br><figure><img loading=\"lazy\" decoding=\"async\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-i4NrOIqIVS.png 569w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-i4NrOIqIVS-300x83.png 300w\" width=\"569\" height=\"158\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-i4NrOIqIVS.png\" alt=\"\"><\/figure><\/li>\n\n\n\n<li><p>From the\u00a0 <strong>catalogue<\/strong>\u00a0menu, choose\u00a0<strong>Update from sources &#8230;<\/strong>:<\/p><p>\u00a0<img loading=\"lazy\" decoding=\"async\" width=\"301\" height=\"75\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-JuDRmweWaA.png\" alt=\"\"><\/p><br><\/li>\n\n\n\n<li><p>That will re-build the\u00a0 <strong>geodirectory-en_US.po<\/strong>\u00a0file:<\/p><p><img loading=\"lazy\" decoding=\"async\" sizes=\"auto, (max-width: 375px) 100vw, 375px\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-M48gnilEgp.png 375w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-M48gnilEgp-300x111.png 300w\" width=\"375\" height=\"139\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-M48gnilEgp.png\" alt=\"\"><\/p><\/li>\n\n\n\n<li>Save the file.<\/li>\n\n\n\n<li>You now have a new base language file including the new custom fields. You can now use that file to create your other language files, read more at <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/how-to-translate-or-localize-geodirectory\/\">How To Translate Or Localize GeoDirectory<\/a><\/li>\n<\/ol>\n\n\n\n<p>Translating AUI Strings<\/p>\n\n\n\n<p>To translate calendar strings, Select2 strings and &#8220;time ago&#8221; strings please add the&nbsp; following PHP snippet. We recommend the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippets<\/a> plugin for adding snippets.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">\/**\n * Translate AUI calendar strings.\n *\/\nfunction gd_snippet_ui_calendar_params( $params ) {\n\tforeach ( $params as $key =&gt; $string ) {\n\t\t$string = __( $string );\n\t\t$string = __( $string, &#039;geodirectory&#039; );\n\t\t$params&#091; $key &#093; = $string;\n\t}\n\n\treturn $params;\n}\nadd_filter( &#039;ayecode_ui_calendar_params&#039;, &#039;gd_snippet_ui_calendar_params&#039;, 21, 1 );\n\n\/**\n * Translate AUI select2 strings.\n *\/\nfunction gd_snippet_aui_translate_select2( $params ) {\n\t$_params = geodir_params( &#039;geodir-select2&#039; );\n\n\tforeach ( $_params as $key =&gt; $string ) {\n\t\tif ( isset( $params&#091; $key &#093; ) ) {\n\t\t\t$params&#091; $key &#093; = $string;\n\t\t}\n\t}\n\n\treturn $params;\n}\nadd_filter( &#039;ayecode_ui_select2_params&#039;, &#039;gd_snippet_aui_translate_select2&#039;, 10, 1 );\n\n\/**\n * Translate AUI time ago strings.\n *\/\nfunction gd_snippet_aui_translate_timeago( $params ) {\n\t$geodir_params = geodir_params();\n\n\tforeach ( $geodir_params&#091;&#039;time_ago&#039;&#093; as $key =&gt; $string ) {\n\t\tif ( isset( $params&#091; $key &#093; ) ) {\n\t\t\t$params&#091; $key &#093; = $string;\n\t\t}\n\t}\n\n\treturn $params;\n}\nadd_filter( &#039;ayecode_ui_timeago_params&#039;, &#039;gd_snippet_aui_translate_timeago&#039;, 10, 1 );\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Translating Custom Fields with POEdit Translating AUI Strings To translate calendar strings, Select2 strings and &#8220;time ago&#8221; strings please add the&nbsp; following PHP snippet. We recommend the Code Snippets plugin for adding snippets.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[742,743,741],"article\/categories":[432,211,434],"class_list":["post-909","gd_place","type-gd_place","status-publish","hentry","gd_place_tags-translate","gd_place_tags-translate-custom-fields","gd_place_tags-translate-fields","gd_placecategory-how-tos","gd_placecategory-tips-tricks-more","gd_placecategory-translations"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=909"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/909\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=909"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=909"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}