windows 8 localization - windows

I've got few questions about localization apps in Windows 8.
Is there a way to automatic bind translations to UI element apart from element type? Currently I must provide string with id like "welcomeText.text" for textblock and "welcomeButton.Content" for button. It makes creating files with translations more complicated.
Does Windows 8 has similar solutions to this -> http://developer.android.com/guide/topics/resources/string-resource.html#Plurals ?
Thank you in advance,
Chris

Unfortunately I think the answer to both questions is no.
As for question 1:
If you use the standard way of localizing Windows 8 apps you will have to specify the property, which is not great but understandable; how else would the platform know to what property it should bind? Perhaps I want to bind the Header property instead of the Content property.
There is no way for the platform to determine what I want unless I specify it.

Related

MvvmCross localization: switch at runtime

Is there a way to change the current language to another one at runtime ?
For example: be able to switch when a button is clicked or when starting the app, get the user language and switch.
How to tell the plugin to check the user language at startup ?
Thanks in advance for your help.
Is there a way to change the current language to another one at runtime ?
yes, call builder.LoadResources(whichLanguage) on your MvxTextProviderBuilder.cs
For example: be able to switch when a button is clicked
The UI framework isn't really setup to perform switching live. When you switch between languages then the new JSON resource files will all be loaded OK - but existing displayed text will not be updated. This is a bit like most mobile operating systems - if you want to switch language you often need to reboot!
If you wanted to add dynamic switching then you'd have to find a way to tell the UI to completely refresh all text - I suspect this wouldn't be hard to do, but it might require some manual coding on every page/View which has already been created and displayed :/
or when starting the app, get the user language and switch.
This is a much more straight-forward way to do i18n. It's normally OK because MvvmCross mainly targets phones - and phones are normally single user devices which don't switch languages very often.
You could, for example, use some variable (e.g. System.Globalization.CultureInfo.CurrentUICulture) to work out the best language to display.
Or you detect on load whether the user has picked a language yet - if they have, then show HomeViewModel - if they haven't then show a LanguagePickerViewModel - this is what we did in StarWarsKinect - the StartNavigationObject is a perfect place for this sort of logic!
How to tell the plugin to check the user language at startup ?
Currently, you'll have to code this logic as part of your app startup.
I'd definitely be open to providing an improved plugin on this - perhaps with a demo!
If you are looking at i18n, then one alternative implementation to consider is Vernacular - the team at Rdio have a very good offering for Mono and MS platforms - https://github.com/rdio/vernacular

Dynamics CRM option set

I am new to Dynamics CRM so please excuse me for the newbie question xD
I managed to create an option set field with 2 possibilities:
Scheme 1
Scheme 2
Does anyone have an idea how when a particular possibility is picked, a list of custom based fields will appear in the form? Thanks in advance
If i understand your problem correctly you want certain fields to appear/disappear according to the choice selected in the option set.
The way I see this working is by implementing a Javascript on the onChange event of the option set. you can do this from the 'Form Properties' when changing the layout of the form.
Below is a link showing some examples of possible useful commands that might help you:
http://www.powerobjects.com/blog/2011/01/14/crm-2011-useful-javascript-tidbits/
You can put your custom fields in a custom tab and then hide/disable it according to the value in the option set.
If you have any further problems feel free to ask :)
I hope this helps :)
Gdluck
If you are comfortable working in Visual Studio, I highly recommend installing the Developer Toolkit (You can find the .msi \tools\developertoolkit - download it from here). It will allow you to develop JScript with some syntax highlighting and intellisense and makes source control and deployment a snap.

Localize a WP7 application using MVVM Light

I'm using MVVM Light in my Windows Phone 7 application. The application is to be used in English and Spanish. Users can select a different language during runtime. I'm localizing the application using resource files. I've already been able to make the localization works, but only when I change the language from Settings. In the main page, I have a list for users to select the language during runtime, I'm setting the selected language to Thread.CurrentThread.CurrentCulture, but the text strings in the interface don't get updated. I have a set of properties in the ViewModel that I'm binding to the View to set the labels of the control, but something is missing. I've been reading that I need to implement the INotifyPropertyChanged in the ViewModel to make this works, but I don't know how to exactly do that nor if there is a different better way to implement this case using MVVM Light. Could anybody help me here please?
Hum, I wrote a blog post about it sometimes ago ( http://wp7wonders.wordpress.com/2010/10/17/localize-a-windows-phone-7-application/ - read the comments too!). The main point is that you have an object between the resource files and your viewmodels which allow to change the dynamically the language.

Joomla 1.6 multilingual function dont change template

everyone knows that joomla 1.6/1.7 have native multilang feature , so im try to use different template for different langs for some reasons.
I were installed 2 templates and set 1 of them for all languages( the joomla dont get me any other choice , i just can select all ) , and one of them set to fa-IR.
after that i were activated the language filter plugin.
i can change the lang variable in get method between "fa" and "en" but i just can see the en template.
anyone know whats the problem?
Joomla does not natively allow you to set different templates per language. WooDzu's suggestion is the standard way of achieving the same result, by assigning templates per menu item, where each menu item also has a particular language assigned to it. If that approach isn't working, then it's likely that your templates are a bit non-standard [are they using a particular framework like T3?], or there may be a bug in Joomla.
A more direct way of approaching the problem is using Chameleon, which does exactly what you were asking for: it detects the language then sets the template based on that.

How can I filter by file type in an IExplorerBrowser in Windows 7 Libraries?

I've created an instance of IExplorerBrowser in my code to create a custom I/O view in one of my dialogs. I've implemented the IServiceProvider and ICommDlgBrowser interfaces in my host class. I use the IExplorerBrowser::BrowseToIDList method to fill the view.
I would like to filter the file types displayed (ex. only PNG files). If I call BrowseToIDList with FOLDERID_Pictures (i.e. "My Pictures") I can use the ICommDlgBrowser::IncludeObject method or IFolderFilter::ShouldShow to restrict which files I allow to be displayed. However, if I browse to the Picture Library on Windows 7 (FOLDERID_PicturesLibrary), neither ICommDlgBrowser::IncludeObject nor IFolderFilter::ShouldShow are ever called.
Is there some limitation to filtering files in libraries on Win7 that I'm unaware of? Perhaps I'm missing an interface or maybe I've specified the wrong flag somewhere.
Any ideas would be greatly appreciated.
I've had a chance to research this further, including asking a few questions to some Microsoft developers. It would appear, unfortunately, that filtering does not work with query backed views (i.e. Libraries).
An alternative to my approach would be to use the Common Item Dialog with application added controls (via IFileDialogCustomize).
(http://msdn.microsoft.com/en-us/library/bb776913(VS.85).aspx)
In my specific case, I'm unable to use a Common Item Dialog, but I thought it might be worthwhile to post this information here for future reference.
If in the future I find any way to filter an IExplorerBrowser control, I'll post that back here too.
I encountered this issue myself.
Yet I have investigated it a little bit further. IExplorerBrowser creates (on my Windows 7 x64 machine) window of ExplorerBrowserControl class. Which itself creates a window of DUIViewWndClassName class. And the very same window (DUIViewWndClassName) is used as a control by dialog created by IFileOpenDialog. Even window procedures are same so there is no subclassing (but I haven't checked each and every subwindow of that control).
And file dialogs are able to filter by file type even in the library folders. So I guess the IExplorerBrowser (or the control it uses) does allow that only Microsoft does not share knowledge how to do that. Or if it does then its somewhat hidden knowledge.
But I got it with IFolderFilterSite (interface supported by IExplorerBrowser from CLSID_ExplorerBrowser). IFolderFilter::ShouldShow isn't called in such cases for library folders. I wasn't able to get ICommDlgBrowser::IncludeObject called (even if I didn't set any IFolderFilter).
EDIT: I managed to get ICommDlgBrowser::IncludeObject called. Somehow I forgot that I have to provide ICommDlgBrowser through IServiceProvider::QueryService rather than through IUnknown::QueryInterface. But still ICommDlgBrowser::IncludeObject is not called for library folders.
I tried using IShellFolderViewDual3->FilterView().
But it's search results.
Thank you.
IShellView *pShellView;
IDispatch *pDSFV;
IShellFolderViewDual3 *pSFVD3;
m_pExplorerBrowser->GetCurrentView(IID_PPV_ARGS(&pShellView));
pShellView->GetItemObject(SVGIO_BACKGROUND, IID_PPV_ARGS(&pDSFV));
pDSFV->QueryInterface(IID_PPV_ARGS(&pSFVD3));
pSFVD3->FilterView(bstrVal);

Resources