1 00:00:00,410 --> 00:00:03,920 Now that we're correctly formatting our dates for our Spanish audience. 2 00:00:03,920 --> 00:00:07,000 It's time to move on to localizing our app for Egypt. 3 00:00:07,000 --> 00:00:10,780 Just like last time we'll need to start by translating RUI strings. 4 00:00:10,780 --> 00:00:13,610 And since the main language in Egypt is Arabic, 5 00:00:13,610 --> 00:00:16,110 we'll need to translate our strings to Arabic. 6 00:00:16,110 --> 00:00:18,850 Unfortunately I don't know much about Arabic, so 7 00:00:18,850 --> 00:00:21,890 translating this is going to be a bit of a challenge. 8 00:00:21,890 --> 00:00:25,580 But luckily we don't have to do all the translations ourselves, 9 00:00:25,580 --> 00:00:29,980 thanks to Google we've actually got access to some professional translators, and 10 00:00:29,980 --> 00:00:32,180 yes that means it costs money. 11 00:00:32,180 --> 00:00:34,150 But let's take a look at it anyway, so 12 00:00:34,150 --> 00:00:38,100 that if the time comes that you need a translation, you'll be ready. 13 00:00:38,100 --> 00:00:42,504 The first thing we want to do is make sure that our strings.xml file is ready for 14 00:00:42,504 --> 00:00:44,051 a translator to look at it. 15 00:00:44,051 --> 00:00:48,381 That means we should add some context around our strings to let the translator 16 00:00:48,381 --> 00:00:50,321 know how the strings will be used. 17 00:00:50,321 --> 00:00:55,680 Over in our strings.xml file an example of this would be the buy string. 18 00:00:55,680 --> 00:01:00,327 Let's add the one above where we set the buy string and then add a comment. 19 00:01:03,032 --> 00:01:11,733 And inside that comment let's write this is the label for the buy button. 20 00:01:11,733 --> 00:01:17,216 It should not exceed seven characters. 21 00:01:17,216 --> 00:01:21,330 And now when someone is translating this for us, they'll know what the string is 22 00:01:21,330 --> 00:01:25,270 used for, and they;ll know that it has a size constraint. 23 00:01:25,270 --> 00:01:27,570 Another thing we can do to make life easier for 24 00:01:27,570 --> 00:01:32,410 translators is to call out any part of our strings that don't need to be translated. 25 00:01:32,410 --> 00:01:37,880 An example of this would be the %1$s, placeholder, and our purchase message. 26 00:01:37,880 --> 00:01:40,410 If you're not familiar with this syntax, 27 00:01:40,410 --> 00:01:42,870 it's just a placeholder that we'll fill in later. 28 00:01:42,870 --> 00:01:46,450 If we flip over to main activity we can see how it's used 29 00:01:46,450 --> 00:01:48,048 in the buy buttons on click listener. 30 00:01:48,048 --> 00:01:54,190 Back in strings.xml, we really don't want that part to be translated and 31 00:01:54,190 --> 00:01:58,270 actually there's a standard way to mark parts of our strings that we don't want 32 00:01:58,270 --> 00:02:02,540 translated and that is the xliff:g tag. 33 00:02:02,540 --> 00:02:09,900 So right before the percent sign let's type 00:02:14,810 And then use Alt Enter to import the one from urn:oasis. 35 00:02:14,810 --> 00:02:22,380 Then let's give this an id of date, and then let's close this opening tag. 36 00:02:23,560 --> 00:02:27,780 Finally let's add a closing xliff:g tag after our placeholder. 37 00:02:30,350 --> 00:02:31,820 Now when we submit our strings for 38 00:02:31,820 --> 00:02:35,400 translation the translator will know to ignore a placeholder. 39 00:02:35,400 --> 00:02:39,600 Speaking of submitting for translation, over in the project pane lets right 40 00:02:39,600 --> 00:02:43,410 click on string.xml and choose open translations editor. 41 00:02:45,210 --> 00:02:47,080 Then, let's click on Order a translation. 42 00:02:48,190 --> 00:02:51,950 And now, we're brought to a website where we can order a translation. 43 00:02:51,950 --> 00:02:56,307 So let's select the Source Language of English, and then let's drag and 44 00:02:56,307 --> 00:02:58,212 drop in our strings.xml file. 45 00:03:02,588 --> 00:03:03,400 And then, hit Next. 46 00:03:04,910 --> 00:03:07,953 Then let's pick Arabic, and hit Next again. 47 00:03:09,954 --> 00:03:14,930 And now we've just got to pick a service provider and order a translation. 48 00:03:14,930 --> 00:03:19,890 And in about a week, we'll have all of our strings translated into a new language. 49 00:03:19,890 --> 00:03:21,140 Pretty cool, right? 50 00:03:21,140 --> 00:03:22,870 Now let's pretend it's a week later and 51 00:03:22,870 --> 00:03:25,070 we've just gotten back our Arabic translations. 52 00:03:26,590 --> 00:03:28,526 Let's create a new values resource file. 53 00:03:30,745 --> 00:03:32,670 And again let's name it Strings. 54 00:03:33,870 --> 00:03:35,613 Then let's add the locale qualifier. 55 00:03:37,602 --> 00:03:39,630 And for the language, let's pick Arabic. 56 00:03:41,640 --> 00:03:45,470 Finally let's copy and paste in the Arabic strings from the teacher's notes below. 57 00:03:48,340 --> 00:03:49,287 Then let's run the app. 58 00:03:51,861 --> 00:03:53,867 And change the language to Arabic. 59 00:03:58,037 --> 00:03:58,780 Which is this one. 60 00:04:00,560 --> 00:04:05,720 And immediately the UI changes from left to right to right to left. 61 00:04:05,720 --> 00:04:09,883 This is why it's so important to use gravity.start and end, 62 00:04:09,883 --> 00:04:12,460 instead of gravity.left and right. 63 00:04:12,460 --> 00:04:14,988 Now let's use the recent apps button to jump back to our app. 64 00:04:14,988 --> 00:04:20,540 And all right, the app is now in arabic and 65 00:04:20,540 --> 00:04:23,410 the navigation drawer even comes in from the right. 66 00:04:23,410 --> 00:04:29,268 Awesome, and if we pick a color the price is formatted appropriately too. 67 00:04:29,268 --> 00:04:33,370 And clicking the buy button, it looks like we've got a date in there. 68 00:04:33,370 --> 00:04:37,927 Nice, our app is now ready for market in Spain and Egypt. 69 00:04:37,927 --> 00:04:42,030 But that doesn't mean we're done with our localization effort to really localize 70 00:04:42,030 --> 00:04:44,726 an app you not only need to localize the app itself, but 71 00:04:44,726 --> 00:04:48,725 you also need to localize the place you're listing for your app. 72 00:04:48,725 --> 00:04:50,420 You'll need to get different screenshots for 73 00:04:50,420 --> 00:04:54,730 different languages and even update all of the promotional graphics too. 74 00:04:54,730 --> 00:04:55,680 Once that's done, 75 00:04:55,680 --> 00:04:59,530 you'll probably also want to run a beta test before launching the app. 76 00:04:59,530 --> 00:05:02,550 Doing a beta first is always a best practice, but 77 00:05:02,550 --> 00:05:06,000 it's especially important when it comes to localization. 78 00:05:06,000 --> 00:05:08,150 When you aren't a native speaker of a language, 79 00:05:08,150 --> 00:05:11,340 it's pretty tough to know that you got a good translation. 80 00:05:11,340 --> 00:05:15,170 And having local native speakers test your app before you release it 81 00:05:15,170 --> 00:05:16,170 is just a good idea. 82 00:05:17,190 --> 00:05:21,140 Localizing an app can be a lot of work, but if you've got a large audience and 83 00:05:21,140 --> 00:05:25,620 a country that you don't yet support, not only are your users not getting the best 84 00:05:25,620 --> 00:05:30,030 possible experience but you could be missing out on a lot of new revenue. 85 00:05:30,030 --> 00:05:34,050 And especially since Google's made this process so easy there's fewer and 86 00:05:34,050 --> 00:05:36,700 fewer reasons to not localize your app. 87 00:05:36,700 --> 00:05:39,890 Hopefully, this is giving you a pretty good idea of how to support 88 00:05:39,890 --> 00:05:42,620 all kinds of locales all around the world. 89 00:05:42,620 --> 00:05:44,020 And if you've got any questions or 90 00:05:44,020 --> 00:05:48,100 ideas about localizing an app be sure to post them in the community. 91 00:05:48,100 --> 00:05:48,840 Until next time.