{"id":1520082,"date":"2018-02-16T11:35:46","date_gmt":"2018-02-16T11:35:46","guid":{"rendered":"https:\/\/wpml.org\/?p=1520082"},"modified":"2018-02-16T11:37:34","modified_gmt":"2018-02-16T11:37:34","slug":"creating-a-multilingual-site-that-uses-google-maps-challenges-and-solutions","status":"publish","type":"post","link":"https:\/\/wpml.org\/ko\/announcements\/2018\/02\/creating-a-multilingual-site-that-uses-google-maps-challenges-and-solutions\/","title":{"rendered":"Creating a multilingual site that uses Google Maps: challenges and solutions"},"content":{"rendered":"<p class=\"lead\">Building a multilingual site that uses advanced Google Maps techniques seems to be a challenge. However, if you approach it correctly using the right tools, it becomes easy, even if you are not a PHP programmer!<\/p>\n<p>We recently built a new <a href=\"https:\/\/real-estate-wordpress.discover-wp.com\/\">multilingual Real Estate reference site<\/a> for <a href=\"https:\/\/toolset.com\/\">Toolset<\/a>, which relies heavily on Google Maps. We built it to showcase Toolset\u2019s capabilities, but it is actually a good example of what can be achieved using Google Maps for multilingual sites with WPML.<\/p>\n<h2>Challenge #1: How to implement a property search within a given radius and make it multilingual<\/h2>\n<p>When your map displays many markers, users expect them to be filtered.<\/p>\n<p>For example, the <a href=\"https:\/\/real-estate-wordpress.discover-wp.com\/map-search\/\">property search<\/a> of our Real Estate site allows you to filter posts by distance. Users can look up properties in a specific location or within a given radius of their current location.<\/p>\n<p>All input fields and button labels should be available in the visitor\u2019s language.<\/p>\n<figure id=\"attachment_1520130\" aria-describedby=\"caption-attachment-1520130\" style=\"width: 700px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/cdn.wpml.org\/wp-content\/uploads\/2018\/02\/searching-based-on-distance.png\"><img decoding=\"async\" class=\"wp-image-1520130\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/searching-based-on-distance.png\" alt=\"Searching properties based on a distance from a point of interest\" width=\"700\" height=\"510\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/searching-based-on-distance.png 1033w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/searching-based-on-distance-150x109.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/searching-based-on-distance-300x219.png 300w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/searching-based-on-distance-768x560.png 768w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/searching-based-on-distance-1024x746.png 1024w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><figcaption id=\"caption-attachment-1520130\" class=\"wp-caption-text\">Searching properties based on a distance from a point of interest<\/figcaption><\/figure>\n<p><strong>Solution<\/strong><\/p>\n<p>Toolset allows you to build <a href=\"https:\/\/toolset.com\/documentation\/user-guides\/front-page-filters\/\">custom searches<\/a> for anything and <a href=\"https:\/\/toolset.com\/documentation\/user-guides\/display-on-google-maps\/displaying-markers-on-google-maps\/\">display the results on Google Maps<\/a>. Your search can include filters by distance, which allows users to search properties around a given location, including near the visitor\u2019s current location.<\/p>\n<p>Toolset plugins are WPML compatible. This means that anything coming from Toolset can be translated in WPML. Field values appear automatically in WPML\u2019s String Translation. Any text that you add into templates can also be easily wrapped in wpml-string shortcodes to make them translatable.<\/p>\n<figure id=\"attachment_1520133\" aria-describedby=\"caption-attachment-1520133\" style=\"width: 700px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/cdn.wpml.org\/wp-content\/uploads\/2018\/02\/label-wpml-ready.png\"><img decoding=\"async\" class=\"wp-image-1520133\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/label-wpml-ready.png\" alt=\"Adding filters-by-distance in Toolset and making some of your form fields WPML ready \" width=\"700\" height=\"331\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/label-wpml-ready.png 797w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/label-wpml-ready-150x71.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/label-wpml-ready-300x142.png 300w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/label-wpml-ready-768x363.png 768w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><figcaption id=\"caption-attachment-1520133\" class=\"wp-caption-text\">Adding filters-by-distance in Toolset and making some of your form fields WPML ready<\/figcaption><\/figure>\n<h2>Challenge #2: How to show marker pop-up tooltips in a given language<\/h2>\n<p>When you click on a specific place in a map, you expect to see greater details and learn more about the object of your interest.<\/p>\n<p>For example, in our Real Estate site, when you click on a marker, a small tooltip pops up to show the property title, its image, and the price.<\/p>\n<figure id=\"attachment_1520135\" aria-describedby=\"caption-attachment-1520135\" style=\"width: 700px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/cdn.wpml.org\/wp-content\/uploads\/2018\/02\/tooltips-maps.png\"><img decoding=\"async\" class=\"wp-image-1520135\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/tooltips-maps.png\" alt=\"Tooltips in markers on a multilingual site that uses Google Maps\" width=\"700\" height=\"410\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/tooltips-maps.png 1000w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/tooltips-maps-150x88.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/tooltips-maps-300x176.png 300w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/tooltips-maps-768x450.png 768w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><figcaption id=\"caption-attachment-1520135\" class=\"wp-caption-text\">Tooltips in markers on a multilingual site that uses Google Maps<\/figcaption><\/figure>\n<p>How would you add these tooltips to your Google maps and make them appear in the appropriate language?<\/p>\n<p><strong>Answer<\/strong><\/p>\n<figure id=\"attachment_1520136\" aria-describedby=\"caption-attachment-1520136\" style=\"width: 416px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/cdn.wpml.org\/wp-content\/uploads\/2018\/02\/custom-fields.png\"><img decoding=\"async\" class=\"size-full wp-image-1520136\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/custom-fields.png\" alt=\"Use custom fields to store post details. Fields are easy to edit and translate, and you can also include them in the map markers.\" width=\"416\" height=\"552\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/custom-fields.png 416w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/custom-fields-113x150.png 113w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/custom-fields-226x300.png 226w\" sizes=\"(max-width: 416px) 100vw, 416px\" \/><\/a><figcaption id=\"caption-attachment-1520136\" class=\"wp-caption-text\">Use custom fields to store post details. Fields are easy to edit and translate, and you can also include them in the map markers.<\/figcaption><\/figure>\n<p>The answer is simple. Use custom post types and custom fields to store information about your posts (or the real estate properties in our case).<\/p>\n<p>Post types and fields make your site easy to maintain. Your site\u2019s editors will know exactly the field to fill in (see the screenshot on the right). In addition, custom fields are easy to translate using WPML.<\/p>\n<p>Then, when you want to display your post information in Google Map markers, you simply pick the fields you need.<\/p>\n<p class=\"clearfix\">Review <a href=\"https:\/\/toolset.com\/2018\/02\/toolset-maps-features-in-reference-sites-viewing-geolocation-and-filtering-by-distance-in-action\/\">this blog post<\/a> to see more details.<\/p>\n<h2>Challenge #3: How to create templates once and translate only the content<\/h2>\n<p>Last but not least, let us imagine that you want to translate only the content and not whole templates.<\/p>\n<p>This also applies to templates that include Google Maps. You expect to set up your map only once, include the appropriate template, and then deal only with the task of translating the post content and fields.<\/p>\n<figure id=\"attachment_1520143\" aria-describedby=\"caption-attachment-1520143\" style=\"width: 700px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/cdn.wpml.org\/wp-content\/uploads\/2018\/02\/template-for-property-pages.png\"><img decoding=\"async\" class=\"wp-image-1520143\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/template-for-property-pages.png\" alt=\"Create your templates once and translate only the content. Template layout for property pages created with Toolset plugins\" width=\"700\" height=\"504\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/template-for-property-pages.png 1192w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/template-for-property-pages-150x108.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/template-for-property-pages-300x216.png 300w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/template-for-property-pages-768x553.png 768w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/template-for-property-pages-1024x738.png 1024w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><figcaption id=\"caption-attachment-1520143\" class=\"wp-caption-text\">Create your templates once and translate only the content. Template layout for property pages created with Toolset plugins<\/figcaption><\/figure>\n<p><strong><br \/>\nSolution<\/strong><\/p>\n<p>If you use Toolset plugins, you can easily separate the tasks of creating templates and translating content.<\/p>\n<p>You create a template only once and make translation-ready all the strings it includes. These include locations on a map, other custom fields, and input fields for your forms, labels, and buttons.<\/p>\n<p>You can make all these elements ready for translation with WPML. Check the <a href=\"https:\/\/toolset.com\/documentation\/translating-sites-built-with-toolset\/\">documentation on how to translate templates built with Toolset<\/a> for details.<\/p>\n<h2>Other interesting applications of Google Maps<\/h2>\n<figure id=\"attachment_1520145\" aria-describedby=\"caption-attachment-1520145\" style=\"width: 349px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/cdn.wpml.org\/wp-content\/uploads\/2018\/02\/maps.png\"><img decoding=\"async\" class=\"wp-image-1520145 size-full\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/maps.png\" alt=\"Other interesting applications of Google Maps\" width=\"349\" height=\"226\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/maps.png 349w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/maps-150x97.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2018\/02\/maps-300x194.png 300w\" sizes=\"(max-width: 349px) 100vw, 349px\" \/><\/a><figcaption id=\"caption-attachment-1520145\" class=\"wp-caption-text\">Other interesting applications of Google Maps<\/figcaption><\/figure>\n<p>Please see the article on <a href=\"https:\/\/toolset.com\/2018\/02\/toolset-maps-features-in-reference-sites-viewing-geolocation-and-filtering-by-distance-in-action\/\">Advanced Google Maps Features in Toolset Reference Sites<\/a> to discover some other interesting applications of Google Maps in WordPress sites.<\/p>\n<p>If you want to learn how to build advanced multilingual sites using Toolset and WPML and without using PHP, please launch a free copy of the Real Estate site.<\/p>\n<h2 class=\"clear\">Want to get in touch with me?<\/h2>\n<p>My name is Agnes Bury. In addition to writing this post, I already build Toolset\u2019s reference and training sites. If you have specific questions about Toolset, just <a href=\"https:\/\/toolset.com\/toolset-free-consultation\/\">ask me<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Building a multilingual site that uses advanced Google Maps techniques seems to be a challenge. However, if you approach it correctly using the right tools, it becomes easy, even if you are not a PHP programmer! We recently built a new multilingual Real Estate reference site for Toolset, which relies heavily on Google Maps. We [&hellip;]<\/p>\n","protected":false},"author":59141,"featured_media":1520135,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"ep_exclude_from_search":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1520082","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcements"],"_links":{"self":[{"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/posts\/1520082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/users\/59141"}],"replies":[{"embeddable":true,"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/comments?post=1520082"}],"version-history":[{"count":8,"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/posts\/1520082\/revisions"}],"predecessor-version":[{"id":1520172,"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/posts\/1520082\/revisions\/1520172"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/media\/1520135"}],"wp:attachment":[{"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/media?parent=1520082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/categories?post=1520082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpml.org\/ko\/wp-json\/wp\/v2\/tags?post=1520082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}