• Go DevMENTAL

    Localizing your Windows Phone app – why and how?

    • 1 Comments

     

    Christian HissibiniWindows Phone developer Christian Hissibini (Histech Solutions) shares how he created apps that target multiple languages and countries. His apps have been successful in both the French France and Canadian English and French stores.

    Note from Susan: I hope Christian’s story helps you build better apps for multiple markets, don’t forget Canadian developers can earn rewards for their apps through Developer Movement!

    This blog post is also available in French/cet post est aussi disponible en francais

    Now take it away Christian!

    Generally, when you start creating a new application, that’s part of a brilliant an idea, or a completely absurd idea, we secretly hope it will become “The Next Big Thing” :).

    Mission Objective: “The Next Big Thing”

    The trick is to seduce the maximum number of users… To this end, the Windows Phone platform offers you the option of making your application available across the entire world or to restrict it to specific countries.

    But to guarantee lots of downloads and good adoption, the application needs to be inviting for a specific public, culture, geographic area and language; hence the practice of localization.

    In this post we will cover

    • What is localizing an application
    • How to prepare your application for an international market
    • Globalizing a Windows Phone application
    • Localizing a Windows Phone application
    • How do you add a new language to your application
    • How do you test your localized applicaiton

    What is localizing an application?

    You have probably already guessed, localizing an application is adapting it to other languages, markets, cultures and regions.

    There are actually two aspects to consider: Globalization and localization.

    Globalization allows an application, when running, to consider cultural aspects for the user (date format, currency, etc…)

    localization is about setting up the application to consider the language and regional parameters of the user. This consists of translating text, reading direction, suitable visuals, etc.

    Now that we have a better understanding of the concepts, let’s take a look at a few advantages of localizing, to try and convert the skeptics.

    What are the advantages of localization?

    • The user experience is far better
    • It allows you to reach a greater market (the whole world)
    • You get more downloads
    • The adoption rate of the application is much higher
    • Etc.

    Put simply, this will help your app become “the Next Big Thing” :). All these points have a positive impact on your application sales in different markets and generate more traffic and users for your application.

    Convinced? Well then lets see how to prepare our application so it’s ready to conquer the world!

    How to prepare your application for an international market?

    Planning to introduce localization from the early stages is easiest, but even if you have a completed project, don’t worry because thanks to the .NET infrastructure, integration is super easy to put in place. Globalization and localization become child's play.

    1. Globalizing a Windows Phone application

    As we said earlier, globalization is all about giving the user a more familiar cultural environment.

    To do this we access the CultureInfo class. This contains language codes for different countries. For example, en-US for US English or fr-CA for French Canada. (which is different from fr-FR for French-France). The instance is ready to be used to format all your local strings (dates, times, currencies).

    Here is a code snippet showing how you can modify the current culture using CultureInfo

    String cul; 
    cul = "fr-CA";
    CultureInfo newCulture = new CultureInfo(cul); 
    Thread.CurrentThread.CurrentCulture = newCulture;
    Thread.CurrentThread.CurrentUICulture = newCulture;
    

    MSDN includes a tutorial “How to build a globalized app for Windows Phone”. In this document you will find different ways to globalize an application and a sample globalized application you can download.

    2. Localizing a Windows Phone application

    Note: in this context, localizing means adapting to the local language and has nothing to do with GPS location…

    Here again, the platform makes our lives easier, because when we create a new Windows Phone project, a resources folder (Resources) is automatically added to the solution. This folder contains a file called AppResources.resx. This file contains strings that you will need to translate. image

    When you click on the AppResources.resx file, the resource editor opens.

    image

     

    As you can see, by default, this file controls values such as ResourceLanguage (which is our application’s default language), ResourceFlowDirection (which determines if the text is read right to left or left to right).

    How do you add a new element to the resources file?

    To add a new element, you just click on a new line and add the name and value for the entry. Couldn’t be simpler right? :)

    Well, still it never hurts to include a screenshot

    image

    Now that we know how to add new values to the resources file, let’s see how we can access these values from our code.

    How to access the resource file from our code?

    The link to the resources file is done through the XAML.

    basically, you just replace the hard-coded text of your attributes with the name of the corresponding resource.

    An example is worth a thousand words.

    Suppose we want to include the following text “If you lie to the compiler, it will get its revenge” a wonderful quote from Henry Spencer which we will need to translate later.

    Without localization, our code would look like this:

    <TextBlock Text="Si on ment à un compilateur, il prendra sa revanche." 
    Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>

    After localization, the code looks like this :

    <TextBlock Text="{Binding Path=LocalizedResources.CitationHenry, Source={StaticResource LocalizedStrings}}" 
    Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>

    In the second example, the TextBlock reads it’s value for the Text attribute from the resource called CitationHenry in the file AppResources.resx.

    In order for this to work, we would of course need to add another entry to our resources file.

    image

     

    The more observant among us will no doubt have noticed that the when you create a new project, if you look at the comments in the default MainPage.xaml of your solution, there are comments regarding localization.

     <!-- LOCALIZATION NOTE:
     To localize the displayed strings copy their values to appropriately named
     keys in the app's neutral language resource file (AppResources.resx) then
     replace the hard-coded text value between the attributes' quotation marks
     with the binding clause whose path points to that string name.
    
     For example:
    
     Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}"
    
     This binding points to the template's string resource named "ApplicationTitle".
    
     Adding supported languages in the Project Properties tab will create a
     new resx file per language that can carry the translated values of your
     UI strings. The binding in these examples will cause the value of the
     attributes to be drawn from the .resx file that matches the
     CurrentUICulture of the app at run time.
     -->

    So it is important to look at those little green comments in the generated files when you create a new project :)

    In the preceding example we saw how to localize our text, but what about images?

    Localizing images

    In practice, localizing an image is the same principle as localizing text. It’s just a matter of specifying the URI for your resource as follows.

      <Image Source="{Binding Path=LocalizedResources.ImageURI, Source={StaticResource LocalizedStrings}}"/>       

    Now that we have a grasp on the principles of localization, it’s time to see how we can make our application accessible to the greatest possible audience and as you have no doubt guessed, that’s done by making it multilingual!

    How do you add a new language to your application?

    Adding one or more languages to your application comes back to adding additional resource files.

    To my knowledge there are 2 ways to do this:

    Method 1 – Manually

    To do it manually, just open the project properties by double clicking on “Properties” in the  Solution Explorer and then selecting the languages you want to support in the “Supported Cultures” list box and the rebuilding the solution to create the corresponding resource files.

    Once the AppResources files are created, you will need to update each file with appropriate corresponding values.

    image

    Method 2 – Using the Multilingual App Toolkit

    This is my favorite method :) and you will quickly see why…

    First you will need to download and install the Multilingual App Toolkit. This is an extension for Visual Studio which simplifies translation.

    When you download the toolkit, choose the language you prefer to work with.

    Once installation is complete, in the Visual Studio menu, choose Tools | Enable Multilingual Toolkit.

    In Solution Explorer, right click on the project and choose Add translation languages.

    A window will open and you can select the desired languages and then when you click OK, the additional resource files are automatically generated.

    image

    here you can see my application ( the original code was in French, so you can see the US English resource files added)

    image

    If you click on this new resource file, you will see that all the entries from your original AppResources file are there, but none of them are translated.

    At this point, you have the choice between translating everything manually or to use the Translation tool provided by the toolkit (check out the Translate button).

    image

    The translation won’t be perfect, so it’s a VERY good idea to proof read or to have a friend who speaks the language proof read your translations, this will avoid confusion and accidental international incidents :)

    Now we have a new language integrated into our project. It’s time to test it and hopefully whoop with joy at our success!

    How to test the application?

    We start by building our solution and launching it in the emulator (or on our phone).

    In the emulator, select Settings | Language + region  then modify the Phone language to French (or whatever language you want to test) then click Restart Phone.

    The application will restart on the emulator (or on your phone) and now??? You have just climbed one more summit towards your goal of world domination!!! Remember our mission objective: The Next Big Thing!!

    We can’t finish this party without sharing a few best practices that will help with strong localization.

    Best practices for localization

    • Separate the resource strings from the code (i.e. avoid having code that sets a hard coded string value, this allows your code to be independent of the language and makes it easier to support additional languages)
    • Do not feel you have to localize everything (you probably don’t need to start localizing button icons, that said there may be times…)
    • Be prepared for longer text strings (often a translated phrase or word is longer than the original)
    • Localize phrases rather than separate words (The sentences will make more sense)
    • Make sure you list parameters in the right order (if your list is in alphabetical order, and you translate the strings, is it still in alphabetical order?)
    • Use unique attributes to identify your resources
    • Pick the right method for translation

    For more details on best practices, check out MSDN “Localization best practices for Windows Phone

    Going further…

    Here are some online resources I found useful both in researching this article and for my own applications. They will help you get further into the world of localization.

    - The superb tutorial « How do you add French to an English Phone app? », by Susan Ibach (@HockeyGeekGirl) (Note from Susan who is reading this because she is translating Christian’s blog post from the original French…thank you, glad you found the post helpful)

    - MSDN article « How to build a globalized app for Windowws Phone».

    - MSDN article « How to build a localized app for Windows Phone »

    - MSDN article « Localization best practices for Windows Phone »

    Conclusion

    We have seen that localizing a Windows Phone application brings some big advantages and it’s important to consider localization logic right from the design phase and finally that making it happen is really child’s play.

    If there is anything in this article you had trouble following, please don’t hesitate to ask questions!
    Good luck with your attempt at the “The Next Big Thing” :)

    P.S. A quick note from Susan – first of all: another great post Christian, thank you! Second, a reminder that Canadian Developers can earn rewards as they learn to code and publish apps on the Windows platforms, visit Developer Movement to find out how you can earn points and cash them in for rewards!

  • Go DevMENTAL

    Visual Studio Tips and Tricks – Formatting your code

    • 1 Comments

    VisualStudioLogoWith a little setup and a keyboard shortcut you can easily keep your code formatted the way you want it!

    We all have our habits in terms of how we format our code. So why not take 5 minutes to modify the Visual Studio settings so the code looks the way you want all the time! No matter what programming language you work with, there are settings you can control that affect the readability of your code.

    Find more Visual Studio tips and tricks here

    In this post I’ll share tips on how to modify a number of formatting settings, including

    • Fonts and Colors
    • Indenting
    • Spacing
    • Braces
    • Line Wrapping

    Fonts and Colors

    In addition to be able to changing the color theme in Visual Studio, you can also modify the font size or the colors used for different highlighting in your code. If you find the green hard to read for comments, you could change the font size, font color, or background color.

    Just go to Tools | Options | Environment | Fonts and Colors (TIP: if you can’t remember that and are in Visual Studio 2012 or higher you could just use Quick Launch to find the Fonts and colors setting!)

    image

    image

    Indenting code

    Is the indenting too much or too little? You decide. The default indentation and tabs is 4 spaces, but you can increase or decrease the indents. Once again, you want to start in Tools | Options | Text Editor | C# | Tabs

    image

    image

    When you return to your code, you will notice the changes have not taken effect. Just use the keyboard shortcut <CTRL><K><D> anywhere in your code to apply your formatting changes. Here you can see the code with the increased indentation after I apply the changes.

    image

    If you are using the Quick Launch featured just search for “tabs”

    In addition to controlling the number of spaces used when code is indented, you can control what is indented. For example, do you prefer to have your braces indented? or inline with the method declaration?

    image

    image

    Braces

    Does the opening brace for a method go after the method name or on the next line? I could start a whole debate over that, but instead I’m just going to let you set it up the way you want it to work! You can control where opening braces appear for method declarations, control blocks and more! Just go to Tools | Options | Text Editor | C# | Formatting | New Lines or search for braces in Quick Launch.

    image

    image

    If you make a change in the settings, don’t forget you will have to use the keyboard shortcut <CTRL><K><D> to apply your formatting changes to existing code.

    Spaces

    Did you know you can control whether you have spaces around parameters in method calls, or expressions in your if statements? Once again this is really a question of personal preference, but great that you can control the settings yourself! Just go to Tools | Options | Text Editor | C# | Formatting | Spacing

    Some people prefer spaces around expressions in if statements to make them more readable.

    image

    image

    Line wrapping

    If you grew up coding in C or using Unix you probably love to fit as much code on one line as you can! But some programmers really like to keep code spaced out across line with clear indentation to make code more readable. Once again, it’s all up to you! Just go to Tools | Options | Text Editor | C# | Formatting | Wrapping and pick the settings you prefer.

    image

    image

    Where can I get Visual Studio 2013?

    All the features above are available in earlier editions of Visual Studio, but there is a lot of great stuff waiting for you in Visual Studio 2013. So if you haven't downloaded a copy yet. Download it and start exploring today.

  • Go DevMENTAL

    Watching Sochi Olympics with Windows Phone, Windows 8!

    • 0 Comments

    Looking for a Windows Phone and Windows 8 app to watch the Olympics or track results? Here are some great apps.

    Olympic apps for Windows 8 and Windows Phone

    Download some great apps available to track the Olympics on your Windows Phone and Windows 8 device

    CBC Sochi 2014

    available for Windows 8 and Windows Phone (search on your phone I found it, but couldn’t figure out the URL).

    The CBC Olympics app provides you with full, wide-ranging, dynamic and real-time coverage of the Sochi Winter Olympic Games, including live streaming of all Olympic competitions. It is available in English and French. The displayed version corresponds to the language that you have selected in your device settings.

    Screen shot 1

    Sochi 2014 Results

    official Windows Phone app from the Sochi winter games.

    The Sochi 2014 Winter Games are in your hands! The official Sochi 2014 Results application provides full details of the sports program of the XXII Olympic Winter Games and XI Paralympic Winter Games. Install the application and follow the medal races in real time. Get quick and easy access to the competition schedule and results. Choose the country you’re supporting, compile your information ticker of selected topics and be alerted with the latest news of your favorite athletes!Sochi 2014 Results

    NBC Live Sports app

    which includes Olympic coverage on your Windows and Windows Phone 8 devices. Through the two apps, viewers will have access to more than 1,000 live events with the NBC Sports Live Extra app. Not sure what time the puck will drop for the first U.S. Men’s Hockey team? No worries! With the NBC Sports Live Extra app, you can even receive push notifications for event start times, so you won’t miss any of the events close to your heart.

    • Don’t forget developers in Canada can build and publish their own apps and earn rewards through Developer Movement!

  • Go DevMENTAL

    The Student Guide to Setting Up the Windows 8 & Windows Phone Dev Environment

    • 0 Comments

    To develop Windows Phone or Windows 8 applications, you need to be running Windows 8. Here are instructions to either install Windows 8.1 as your native OS, or install a virtual machine on your OS to run Windows 8.1 and Visual Studio.

    W8_WP8_better_together

    So you want to build a Windows 8 or Windows Phone app. Well, before you jump into the code, you need to get your dev machine ready to play! Don’t know all that much about Windows 8.1, Visual Studio, or App SDKs? Well you’ve come to the right place. Here’s everything you need to know to set up your app dev environment.

    Important Note for Windows Phone development: When developing for Windows Phone you must either 1) run Windows 8 as your native OS, or 2) run it in a virtual machine, but test the app on an actual phone. You CANNOT run the Windows Phone emulator (used to test the app you’re making) on a virtual machine. For full system requirements to run the emulator with Windows 8 as your native OS, see: http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff626524(v=vs.105).aspx

    To get your dev environment set up, simply follow the steps below. Mac users skip to the end, there’s information for you too!

    STEP 1:

    Download and Install Windows 8.1 from DreamSpark Premium:

    https://www.dreamspark.com/Student/Default.aspx

    STEP 2:

    Search for Windows 8 Pro 64-bit and download

    STEP 3:

    Search for Microsoft Visual Studio 2013 Professional and download/install

    STEP 4:

    For Windows Phone development: Search for and download/install Microsoft Windows Phone SDK 8.0

    And that’s it! Your environment is now set up for development. Be sure to submit your apps to Code Kwondo and Imagine Cup when you’ve published them!

    Did you get stuck? Below are some great installation guides to help you.

    WINDOWS 8 INSTALLATION GUIDES

    For information on how to dual boot Windows 7 and Windows 8 installation: http://www.intowindows.com/how-to-dual-boot-windows-8-with-windows-7/

    For information on how to install Windows 8 on a VHD (Virtual Hard Drive/Machine):

    http://www.intowindows.com/boot-windows-8-from-vhd/

    For information on how to install Windows 8 from ISO/DVD:

    http://www.intowindows.com/how-to-install-windows-8-from-iso-file/

    For information on how to install Windows 8 from USB:

    http://www.intowindows.com/how-to-install-windows-8-from-usb/

    MAC USERS

    No fear, even Mac users can develop for Windows Phone and Windows 8! If you are using a Mac you have two options: run the OS and Developer Tools in a Virtual Machine OR use Boot Camp to install as separate bootable partition.

    For information on how to install Windows on Mac based devices, please see:

    Boot Camp: http://www.intowindows.com/installwindows-8-on-mac/

    Parallels: http://www.maclife.com/article/howtos/how_install_windows_8_virtual_machine_your_mac

    Great tutorial for developing Windows Phone apps on a Mac: http://blogs.msdn.com/b/interoperability/archive/2012/12/21/how-to-develop-for-windows-phone-8-on-your-mac.aspx

    Have fun!

  • Go DevMENTAL

    Free Zombie Art Assets to help you build your game

    • 0 Comments
    imageWant to build a game but don’t have the time (or for some of us, the talent) to create the art assets? Check out the free Zombie art asset pack!

    Always wanted to build a game but thought it was too hard?

    Having beautiful art assets gives your game a much more polished look and feel and makes the game more appealing to your players.

    Sometimes you find a few royalty free assets you can re-use on various websites, but we decided to try and help you by providing some themed art assets you can use for your games. No strings attached!

    The art pack contains character sprite sheets, special effects and objects you can use in your game.

    Don’t forget Canadian developers who publish games to Windows or Windows Phone can earn cool rewards through Developer Movement until June 2014.

    This week let’s check out the assets in the Zombie Pack (If you missed it, there is a Fantasy pack and a Space Pack  as well!)

    Characters include a fabulous collection of fourteen different zombies, a few of which are shown below

    image image image image

    There is also a sheriff who can help you defeat the zombies with an assortment of weapons!

    image image image image

    Add a few weapons and obstacles to make the game more interesting

    image image image image

    How about some special effects for blowing up the zombies such as a puff of smoke or a pile of dust or maybe just the classic stars dancing around the head.

    image image image

    You should also download the background assets collection to find a suitable backdrop art for your game as well.

    image image image

     

    You can find more art asset packs at http://wootstudio.ca/win8platstarter

    Now you have the assets, how do you build your game?

    You might want to check out

    Starter kits

    Courses

    General resources

    If you build something cool, tell us about it!

    Are you a student?

    If you are a student, you don’t have to settle for the Express version of Visual Studio to develop your game! Use the same tools as the professionals by downloading your copy of Visual Studio Professional at DreamSpark! You can download Visual Studio Professional, the Windows Phone SDK, and the Windows 8 SDK all for free! DreamSpark is the student one stop shop for software!

Page 5 of 82 (409 items) «34567»