<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Translation &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/translation/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Tue, 02 Mar 2021 17:51:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Guest Post: Adding Language Translation to Your Xojo Apps</title>
		<link>https://blog.xojo.com/2019/05/13/guest-post-adding-language-translation-to-your-xojo-apps/</link>
		
		<dc:creator><![CDATA[Tim Dietrich]]></dc:creator>
		<pubDate>Mon, 13 May 2019 10:00:17 +0000</pubDate>
				<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[App Localization]]></category>
		<category><![CDATA[CURL]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Middleware]]></category>
		<category><![CDATA[Monkeybread Software]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Translation]]></category>
		<category><![CDATA[Web Service]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=5735</guid>

					<description><![CDATA[I've been amazed at the speed and accuracy of the Amazon Translate service. And after developing the AWSTranslator class, I was able to quickly and easily add language translation to my client's middleware app.]]></description>
										<content:encoded><![CDATA[<p>Recently, I was asked by a client if it would be possible to build language translation functionality into a Xojo-based middleware solution that I had developed for them. The Xojo app obtains product information (including product names, descriptions, and other marketing-related information) from suppliers via a SOAP call, and returns the data in a JSON-encoded response. They wanted to be able to translate the product information, which is provided in English, to other languages (such as French, German, etc). The client wanted something similar to <a href="https://translate.google.com/">Google Translate</a>. However, they wanted the translation function to be built directly into the app and to be performed &#8220;on demand.&#8221;</p>
<p>I did some research and found that Amazon provides a service that does exactly what the client was asking for. The service, called <a href="https://aws.amazon.com/translate/">Amazon Translate</a>, is available as one of many services that are available through Amazon Web Services.</p>
<p>In this post, I&#8217;ll walk you through the process of getting signed up for Amazon Translate, and then share some code that you can use to add language translation to your own Xojo projects. We&#8217;ll use the MBS Xojo CURL Plugin, which makes calling the Amazon Translate API easy. But first, let&#8217;s learn a little about Amazon Translate.</p>
<p><span id="more-5735"></span></p>
<h3><b>Amazon Translate</b></h3>
<p>Amazon Translate is an API that can be used to translate text on demand. You send it text in a &#8220;source language,&#8221; tell the API what that source language is, as well as the &#8220;target language&#8221; that you want the text translated to. The API responds with the translated text.</p>
<p>Amazon Translate uses machine learning and neural networks that have been designed specifically for language translation. When performing a translation, the service reads the text one sentence at a time, and reads each word individually, to determine the meaning of a sentence. In other words, the service doesn&#8217;t just translate words. Instead, it&#8217;s acting as an interpreter. This results in translations that are extremely accurate.</p>
<p>In order to use Amazon Translate, you&#8217;ll need an <a href="http://aws.amazon.com/">AWS account</a>. If you already have an AWS account, log into the account.</p>
<p>Next, you&#8217;ll need to create an &#8220;Identity and Access Management&#8221; (IAM) user. To do so, under Services, select &#8220;IAM&#8221; (which can be found in the &#8220;Security, Identity, &amp; Compliance&#8221; category). This will present you with the IAM Dashboard.</p>
<p>Under Groups, create a new group and give it a recognizable name. For example, you might call the group &#8220;translate.&#8221; As you are creating the group, give it the &#8220;TranslateFullAccess&#8221; permission.</p>
<p>Next, create an IAM user. Under Users, click the &#8220;Add user&#8221; button. Give the user a name such as &#8220;XojoTranslater.&#8221; For the &#8220;AWS access type&#8221; be sure to select &#8220;Programmatic access.&#8221; Add the user to the &#8220;translate&#8221; group that you created above. There&#8217;s no need to assign any tags to the user, so you can skip that step.</p>
<p>And finally, create an Access key for the user. Be sure to make note of both the &#8220;Access key ID&#8221; and &#8220;Secret access key&#8221; values that are automatically assigned. You&#8217;ll need these in order to make API calls.</p>
<h3><b>The MBS Xojo CURL Plugin</b></h3>
<p>If you don&#8217;t already have the <a href="https://www.monkeybreadsoftware.de/xojo/plugin-curl.shtml">MBS Xojo CURL Plugin</a>, download it and install it. To install the plugin, simply drag it into the Xojo &#8220;Plugins&#8221; folder.</p>
<p>The project will work with an unlicensed version of the MBS Xojo CURL Plugin. In this case, you&#8217;ll occasionally see a popup message reminding you to purchase a license. However, I highly encourage you to purchase a license. You can license the plugin individually, or as part of the MBS Complete plugin bundle.</p>
<h3><b>The Xojo Example Project</b></h3>
<p>To demonstrate the Amazon Translate service, I&#8217;ve put together an example Xojo desktop project (<a href="https://s3.amazonaws.com/tdietrich-opensource/aws-translate-demo.xojo_binary_project.zip">project file</a>). Before running the application, be sure to set the three App-level properties: AWSAccessKeyId, AWSSecretAccessKey, and the AWSRegion. For the AWSAccessKeyId and AWSSecretAccessKey properties, use the values that you set when you created the Access key for the user. For the AWSRegion, refer to <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html">this</a> and use the value that makes the most sense for you.</p>
<p>Once you&#8217;ve configured the app, run it, and it will look something like this.</p>
<p> </p>
<h3><b>The Xojo Code</b></h3>
<p>Let&#8217;s take a look at some of the code.</p>
<p>The AWSTranslator class is a subclass of the CURLSMBS class. The class does two important things: It provides access to a list of the languages that are supported, and provides a method for calling the Amazon Translate API.</p>
<p>The &#8220;Languages&#8221; property is a dictionary that you can use to get the names of the languages that Amazon Translate supports and the corresponding language codes. The example app uses this dictionary to populate the &#8220;Translate From&#8221; (SourcePopupMenu) and &#8220;Translate To&#8221; (TargetPopupMenu) popup menus.</p>
<p>The Translate method creates the payload that gets sent to the Amazon Translate API, and sets special HTTP headers that are needed in order to call the API. But most importantly, it uses the CURLSMBS class&#8217;s &#8220;SetupAWS&#8221; method to configure the CURL instance so that all of the steps that are required to &#8220;sign&#8221; the API request are done automatically. This is an amazingly convenient function of the MBS Xojo CURL Plugin. You can get a sense of what&#8217;s involved in signing the request <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">here</a>.</p>
<p>To translate text using the AWSTranslator class, you create an instance, configure it with your IAM credentials and AWS region, pass it the source language text, the source language code, and the target language code. In the example app, this all handled in the Window1.Translate method. The values are pulled from the App-level properties, as well as the various window controls. Finally, you call the AWSTranslator instance&#8217;s Translate method. If the translation is successful, the translated text will be available via the TranslatedText property. If any errors occur, the ErrorType and ErrorMessage properties will be set.</p>
<p>The &#8220;Estimated Translation Cost&#8221; is calculated whenever the Source Text changes. The value is calculated by taking the length (number of characters) of the Source Text and multiplying it by 0.000015 (the average cost for translating a single character).</p>
<h3><b>Wrapping Up</b></h3>
<p>I&#8217;ve been amazed at the speed and accuracy of the Amazon Translate service. And after developing the AWSTranslator class, I was able to quickly and easily add language translation to my client&#8217;s middleware app.</p>
<p>I hope you&#8217;re equally impressed by the Amazon Translate service, and that you find the AWSTranslator class to be helpful in your own Xojo projects.</p>
<p><i>Tim Dietrich is a custom software developer based in Richmond, Virginia. To learn more, visit: <a href="https://timdietrich.me/" target="_blank" rel="noopener noreferrer" data-saferedirecturl="https://www.google.com/url?q=https://timdietrich.me&amp;source=gmail&amp;ust=1552488320387000&amp;usg=AFQjCNEDiwUxo_XLnpKX-Bt3nL8FIQTxZA">https://timdietrich.me</a></i></p>


<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="1024" height="711" src="https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM-1024x711.png" alt="" class="wp-image-5753" srcset="https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM-1024x711.png 1024w, https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM-300x208.png 300w, https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM-768x533.png 768w, https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM.png 1532w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>The Klingon Translator App You Definitely Need</title>
		<link>https://blog.xojo.com/2019/03/07/the-klingon-translator-app-you-definitely-need/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Thu, 07 Mar 2019 10:00:02 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Star Trek]]></category>
		<category><![CDATA[Translation]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=5512</guid>

					<description><![CDATA[chay' tlhIngan Hol mughwI' chenmoH qaStaHvIS 20 tlhegh ngoq xojo je ghoj

Qapla']]></description>
										<content:encoded><![CDATA[<p>I love the new Star Trek Discovery and there are a fair amount of Klingons in it, from time to time. It occurred to me that someone has probably built a web service to translate English to Klingon and if so, I <em>needed</em> to build a Xojo app to use it.</p>
<p>A quick Google search turned up an API by FunTranslations: <a href="https://funtranslations.com/api/klingon">https://funtranslations.com/api/klingon</a></p>
<p>It has simple usage where you send along the text in English and you get back a JSON result containing the text translated to Klingon. Here&#8217;s the result of my 15 minutes of effort to use this in a Xojo desktop app:</p>
<p><span id="more-5512"></span></p>
<p><img decoding="async" class="wp-image-5513 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2019/03/2019-03-06_15-34-28.png" alt="" width="600" height="422" /></p>
<p>This is a pretty simple project with less than 20 lines of code.</p>
<p>You can recreate the layout using a couple TextFields and a Button. I used <a href="https://documentation.xojo.com/api/networking/urlconnection.html">URLConnection</a> to connect to the web service. You can also add that to the layout by dragging an Object from the Library and changing its Super property to &#8220;URLConnection&#8221;. I named this object &#8220;KlingonAPI&#8221;.</p>
<p>In the Button&#8217;s Action event the code sets up the call to the web service using the text entered in the first TextArea:</p>
<pre>Dim url As String = "https://api.funtranslations.com/translate/klingon.json"

Dim param As String = "text=" + EncodeURLComponent(EnglishArea.Text)

KlingonAPI.SetRequestContent(param, "application/x-www-form-urlencoded")
KlingonAPI.Send("POST", url)</pre>
<p>In the KlingonAPI URLConnection object, add the ContentReceived event. This code grabs the translated Klingon text from the JSON and displays it in the 2nd TextArea:</p>
<pre>Try
  Dim json As New JSONItem(content)
  Dim contents As JSONItem
  contents = json.Value("contents")
  Dim klingonTranslation As String = contents.Value("translated")
  KlingonArea.Text = klingonTranslation
Catch e As JSONException
  MsgBox("Error processing API call. Content=" + content)
End Try</pre>
<p>You can also add the Error event and have it display an error in case there&#8217;s a problem with the API call:</p>
<pre>MsgBox("API Error: " + e.Message)</pre>
<p>And that&#8217;s all there is to it.</p>
<p>You can download the project from here: <a href="http://files.xojo.com/BlogExamples/KlingonTranslator.xojo_binary_project">KlingonTranslator Project</a>, just remember some things can&#8217;t be translated!</p>
<p><a href="https://imgflip.com/i/1rqwov"><img decoding="async" class="aligncenter" title="made at imgflip.com" src="https://i.imgflip.com/1rqwov.jpg" width="438" height="329" /></a></p>
<p>I&#8217;ll leave it up to you to implement a Klingon to English translator, although you may want to make that a mobile app in case you are ever teleported to the bridge of a Klingon vessel.</p>
<p>Qapla&#8217;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Localize Your Edit Menu on Mac</title>
		<link>https://blog.xojo.com/2018/09/19/localize-your-edit-menu-on-mac/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 19 Sep 2018 10:00:21 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[App Localization]]></category>
		<category><![CDATA[Translation]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4956</guid>

					<description><![CDATA[On macOS you may have noticed two special menu items that appear at the bottom of the Edit menu: "Start Dictation" and "Emoji &#038; Symbols". These menu items are added automatically by macOS provided your Xojo app follows a few simple rules.]]></description>
										<content:encoded><![CDATA[<p>On macOS you may have noticed two special menu items that appear at the bottom of the Edit menu: &#8220;Start Dictation&#8221; and &#8220;Emoji &amp; Symbols&#8221;. These menu items are added automatically by macOS provided your Xojo app follows a few simple rules.</p>
<p><span id="more-4956"></span></p>
<p>For English systems you don&#8217;t have to do anything. By default the Edit menu text is &#8220;Edit&#8221; so macOS will find it and automatically add &#8220;Start Dictation&#8221; and &#8220;Emoji &amp; Symbols&#8221;. Should you not want them to appear, you can change the text so that it is &#8220;Edit &#8221; (with an extra trailing space).</p>
<p>For non-English systems you will need to provide a Dynamic Constant to use in place of the hard-coded text of &#8220;Edit&#8221; on the EditMenu. This dynamic constant needs to have the appropriate translation for Edit as required by macOS.</p>
<p>Here&#8217;s how you can set this up for a variety of languages.</p>
<p>Added a public Dynamic Constant to App:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4957" src="https://blog.xojo.com/wp-content/uploads/2018/09/2018-09-17_11-54-48.png" alt="" width="990" height="196" /></p>
<p>Then use it in the menu:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4958" src="https://blog.xojo.com/wp-content/uploads/2018/09/2018-09-17_11-55-09.png" alt="" width="991" height="196" /></p>
<p>When you run the project with French set as the primary language you will see &#8220;Démarrer Dictée&#8221; in the Édition menu:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4959" src="https://blog.xojo.com/wp-content/uploads/2018/09/2018-09-17_11-56-11.png" alt="" width="247" height="225" /></p>
<p>Do the same thing for other languages you need. The easiest way that I found to determine the correct word was to change your System Language and then start a built-in Apple app such as Notes or Safari and make a note of what the &#8220;Edit&#8221; menu is called.</p>
<p><a href="http://files.xojo.com/BlogExamples/EditLocalization.xojo_binary_project">Download a project</a> with the above languages in a Dynamic Constant.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>5 Things to Keep in Mind When Localizing Your App</title>
		<link>https://blog.xojo.com/2017/08/03/5-things-to-keep-in-mind-when-localizing-your-app/</link>
		
		<dc:creator><![CDATA[Dana Brown]]></dc:creator>
		<pubDate>Thu, 03 Aug 2017 19:35:35 +0000</pubDate>
				<category><![CDATA[Dev Marketing]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[App Localization]]></category>
		<category><![CDATA[App Marketing]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Translation]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=2728</guid>

					<description><![CDATA[If your app will be used by people all over the world, take the time to consider localizing it appropriately.]]></description>
										<content:encoded><![CDATA[<p>If your app will be used by people all over the world, take the time to consider localizing it appropriately. Localizing your app is a great way to increase downloads and grow your user base.</p>
<p>Here are 5 basics to consider when localizing your app:</p>
<p><span id="more-2728"></span></p>
<p><strong>1. Different Word Lengths</strong><br />
Some languages, such as German, have longer words than other languages like English. When designing your UI controls, you&#8217;ll need to account for this. A common way is to make the buttons large enough to accommodate the longest text.</p>
<p>You could also add code to the UI controls to have it resize itself if the localized text would not fit. But resized controls can also affect other controls on your layout, so a system like auto-layout can also help greatly to ensure that your UI adjusts itself appropriately when the text changes.</p>
<p><strong>2. Don&#8217;t use Google Translate</strong><br />
Find someone that natively speaks both languages to do your translation. Obviously, you will need more than one person if you are translating to many languages.</p>
<p>Google Translate has its uses, but it&#8217;s translations often have unusual (or wrong) words and phrasing. So even though the text will be in the localized language, it could still remain difficult for native speakers to understand.</p>
<p>You don&#8217;t want your translations to say &#8220;Throw me down the stairs my shoes.&#8221; when it should say &#8220;Toss my shoes down the stairs to me.&#8221;</p>
<p><strong>3. Don&#8217;t forget about dates</strong><br />
Date formats vary, so be sure to consider how they are displayed. What is the date for 3/7/14? Is it March 7th, 2014 or July 3rd, 2014? For internal dates that are not displayed to the user, you should use a standard format, such as SQL Date: YYYY-MM-DD.</p>
<p>When displaying dates, you should always use the user&#8217;s OS settings. This applies to both short dates with just the numbers and long dates where the month and day are spelled out.</p>
<p>And remember the position of each date component. Some places might use &#8220;March 7th, 2014&#8221;, but others would use &#8220;7 march 2014&#8221;.</p>
<p><strong>4. Numbers</strong><br />
As with dates, numbers are also displayed differently. Not all countries use a &#8220;.&#8221; as the decimal separator. Not all countries use &#8220;,&#8221; as the thousands separator. The display of 3456.78 could be &#8220;3,456.78&#8221; is one location, but &#8220;3 456,78&#8221; in another.</p>
<p>Ask the operating system for the values specific to the user&#8217;s system settings.</p>
<p>And as with dates, when using numbers internally always use a standard and consistent format so that you can read them correctly regardless of the localization.</p>
<p><strong>5. Currency</strong><br />
This trend continues with currency. Don&#8217;t presume that &#8220;$&#8221; is the currency symbol. As above, you should ask the OS for the specific currency symbol. And when storing currency values, do not include the currency symbol as that could make doing math on the values more difficult.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
