How to change cultureinfo during runtime in Windows Phone? - windows-phone

In windows phone how can I change between 2 cultures inside the app, for example when user clicks on language setting inside app, it should change between English and Arabic, based on the Appresource files I created?
I have tried this on button click, but doesn't work:
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ar-SA");
Thanx

I run to similar problem once in the past. Maybe you havent added arabic as Supported Culture in the poject properties. This is what i did:
Edit .csproj in notepad
Add SupportedCultures tag inside PropertyGroup tag, and list languages your application will support
This is the sample format:
<PropertyGroup>
.
.
.
<SupportedCultures>
en-US; ar-SA;
</SupportedCultures>
</PropertyGroup>
That was work for me.

Related

Xamarin Forms Localization using Resx

I've followed this quick lesson to add localization to a XamarinForms app:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/localization/text?pivots=windows#specify-the-default-culture
Their provided project works correctly - in that I can change languages by changing [assembly: NeutralResourcesLanguage("en-US")] in AssemblyInfo.CS.
In my own project, using the same ResX strings in a XAML layout I cannot change the language from anything other than en-GB.
Edit - Removing resx files and recrafting seems to have done the trick.

xaml layout file won't link to Strings in Resource.resw

I have created a simple hub app
the default template has this HubPage.xaml
since x:Uid the strings should be yet linked to Resurces.resw in Strings folder (if I have understod the documentation)
so I have created the folder for another language and edited both Resurces.resw files to show the name Bla Bla Test rather than default "application name"
unfortunately this doesn't work and header continues to show "application name" ignoring Resurces.resw
What is wrong?
update: following the suggestion of Romasz(see the comments) when I run the emulator is correctly shown the value of Resurces.resw...why in the preview this not happens
From what I've tried with default template (Hub App), there seems to be a little mistake in Resources.resw file. Instead of HubSection1 -> Section 1 there should be HubSection1.Header -> Section 1 - x:Uid defines the name of an element, but in resources there should be added a path to property.
Nevertheless, from my experience and what I've tried, the designer preview won't show values from Resources.resw file. To see the effect you will have to build and run your project on emulator/devidce.

How do I add my privacy policy link to the Windows Settings charm with Unity?

Windows Store rule 4.1.1 mandate that:
You must provide access to your privacy policy in the Description page
of your app, as well as in the app’s settings as displayed in the
Windows Settings charm.
The Description page is easy, since when you setup your app in the store there's a field where you can enter the URL.
However I'm a bit clueless about how to add this entry in the Windows Setting charm in a Unity project. I've found this answer but that assumes you are in full control and knowledge of your Windows Store app, while I'm just exporting from Unity, so I've no clue on where I would put that code.
So, how do I do that?
Unity is exporting the game as JS or C#.
So have a look to these samples http://code.msdn.microsoft.com/windowsapps/Windows-8-Modern-Style-App-Samples. In these samples, there are a few Setting Charm screnios that you can use in your application.
But remember that, you should add setting charm after export the game.
The plugin prime31/MetroEssentials has the function registerSettingsCommand, which allows you to do just that.
// Registers a settings item with an associated message that will be displaed in a popup when clicked
public static void registerSettingsCommand( string title, string message )
// Registers a settings item with an action. When the settings item is clicked the action will be called.
public static void registerSettingsCommand( string title, Action onActivated )

VS 2010 to VS2012 and Project Name Change - Area forms HttpPost no longer working

I just created a new project in VS 2012 - basically replicated what I had in 2010 but changed all the namespaces to a different project name. All is working except my Area forms are no longer being directed to the HttpPost version of the action. Instead, the submit is redirecting to the HttpGet. Any ideas? My Areas appear to be registered correctly and no code has changed (other than namespace references).
Okay, I figured it out! Not sure why this didn't work, but for my other routes, I was using LowercaseRoutesMVC4 and didn't apply this to my Area routing. Not sure why this would break it, but it seems to be working now.

Localize Windows Service

I want to Set Culture for Windows Service that I developed. Can someone recommend me a good read for or how to go about it.
So far I have I Tried to do the Following OnStart()
Dim oCultureInfo as CultureInfo = New CultureInfo("tr-TR")
System.Threading.Thread.CurrentThread.Culture = oCultureInfo
System.Threading.Thread.CurrentThread.UICulture = oCultureInfo
After doing so I still see that My culture is US English.
Go to your setup which will be in the same solution.
Right click on it and select ADD->PROJECT OUTPUT--> a window will appear.
Select Project- your localization project then select from below localized resource.
Just click ok. you will see one file is added to setup project.
Just compile and install it will work fine.