locked
Globalization/Tile/BackgroundTask - tile pictures are not changed due to language in the system

    Question

  • Could you please advise on bellow problem? 

    I'm trying to localize my App. Strings are localized well and they are changed due to language in the system.

    But tile's pictures are used only for LAST SET language and they are not changed after any changing of language in the system, even after re installing of the App.

    For example, steps:
    1. Default language in App is "en-us", English US is set like a first language in the system (Control Panel->Clock, Language, and Region->Language), project has corresponding pictures,  corresponding tile's notifications are send and all work correctly

    2. New language "ru-ru" was added, corresponding images were added to sub-folder "ru-ru", this language was set in the system, app package was re installed and new tile's are "ru-ru". It's correct.

    3. System language was changed back to "en-us"... but tile's are "ru-ru"... even after re installing of the App

    Why?

    Some project details:

    1. It's file's structure in the test project:

    2. It's code for sending of the notification to tile (I've checked this method is called correctly and in time):

    public static void sendTileNotification()
    {
        //get network info object
        NetworkInfo networkInfo = NetworkInfo.getInstance();
    
        //determine picture file name
        string pictureName = getPictureName(networkInfo.connectionType);
    
        //create wide 310x150 image xml-block
        ITileWide310x150Image wideImageContent = TileContentFactory.CreateTileWide310x150Image();
        wideImageContent.Branding = TileBranding.None;
        wideImageContent.Image.Src = "ms-appx:///images/wideTiles310x150/" + pictureName;
        wideImageContent.Image.Alt = "";
    
        //create square 150x150 image xml-block
        ITileSquare150x150Image squareMidiumContent = TileContentFactory.CreateTileSquare150x150Image();
        squareMidiumContent.Branding = TileBranding.None;
        squareMidiumContent.Image.Src = "ms-appx:///images/squareTiles150x150/" + pictureName;
        squareMidiumContent.Image.Alt = "";
    
        //link xml-blocks
        wideImageContent.Square150x150Content  = squareMidiumContent;
        
        //send tile update notification
        //(!) by default:
        //    expiration time is empty
        //    notification queue is disabled
        TileUpdateManager.CreateTileUpdaterForApplication().Update(wideImageContent.CreateNotification());
    }

    Tuesday, October 07, 2014 10:23 AM

Answers

  • Hi dima,

    Your code looks correct as the documentation mention How to use localized images and text in a notification

    But from your description, looks like if you change the language from default en-us to ru-ru, everything works fine, but when switch back from ru-ru to default en-us, something wrong here.

    Please double check if your app default language is set to en-us? A possibility is your app default language is not en-us, while install the app to the device, app cannot find en-us, it use default setting because it cannot find en-us folder, while switch back from ru-ru, app cannot find en-us, it still use ru-ru.

    Give a try if you add another en-us folder with image in the assert folder, to see if you can get correct tile while switch the language.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by _dima Wednesday, October 08, 2014 12:26 PM
    Wednesday, October 08, 2014 6:29 AM
    Moderator

All replies

  • Hi dima,

    Your code looks correct as the documentation mention How to use localized images and text in a notification

    But from your description, looks like if you change the language from default en-us to ru-ru, everything works fine, but when switch back from ru-ru to default en-us, something wrong here.

    Please double check if your app default language is set to en-us? A possibility is your app default language is not en-us, while install the app to the device, app cannot find en-us, it use default setting because it cannot find en-us folder, while switch back from ru-ru, app cannot find en-us, it still use ru-ru.

    Give a try if you add another en-us folder with image in the assert folder, to see if you can get correct tile while switch the language.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by _dima Wednesday, October 08, 2014 12:26 PM
    Wednesday, October 08, 2014 6:29 AM
    Moderator
  • Hi, James

    Thank you for your help it really helped me!

    I've moved en-us images from root folder to en-us sub folder and it works correctly: 

     

    Some details:

    1. The App has "en-US" like a default  language, I've double checked it, it was "en-US" always. 

    2. Due to this instruction "How to structure your app package for globalization and accessibility":

    • Create a folder named "images". Add the images for your default language, named with its BCP-47 specification, directly to the root of this folder.
    • Localization: Within the "images" folder, create folders for each supported non-default language,each named with their BCP-47 specification.

        I've added en-us images directly to the root of folder "images".

    3. And as you said - when user sets non-default language "ru-ru" and after that  he sets back default language en-us the App finds images in the "en-us" sub folder, but "en-us" sub folder is sure absent and the App uses last set language "ru-ru".

    Some my thoughts:
    Or am I doing something wrong,
    or we have to duplicate the images of the default language in the two folders (root and sub),
    or we can place them only in the sub folder (so above instruction is wrong)

    Now I've used 3rd way, it works, I'm happy.

    Wednesday, October 08, 2014 12:26 PM