Titanium - change language programmatically - appcelerator

I want to change the language of the app inside it. I want to allow the user to change the language from settings.
Is it possible?? because I can't find a setLocale() method or something similar.
Thanks.

I'm afraid this isn't possible using the build in tools. The build in tools are used by Android and iOS specifically to change the language based on the OS settings.
The way you can do this is by making it custom. Defining your own global function to get translations from (instead of the L() function). But this also requires you to put your translation files somewhere else.

The following line works although it is not documented. I think it will be documented soon and you will get a convenient way to change language on run time. Of course you will have define your own translation.
Ti.Locale.setLanguage("fr");

It is possible. I am using this module from the marketplace:
iOS: https://marketplace.appcelerator.com/apps/144434#!overview
Android: https://marketplace.appcelerator.com/apps/144430#!overview

Related

How to share from an app to Xamarin macOS

I'm looking to add the availability to my application to receive content through share option from Note native apple application. I want my application appear in the list below.
Thanks, Robin.
You need to add the new project with the share extension and reference it in the main project.
One more critical part is that you need to declare in extension's info.plist which content you want to import.
Also of note, you indicated by the tag that you use Xamarin.Forms. It might be complicated to use Xamarin.Forms for the user interface in the Mac share extension. I would believe it is possible, but I don't think anyone did that and published info on how to do it.

Design and print PDF in Xamarin.Forms

I am working on a Xamarin.Forms project.
I have to create an ID card from the details provided, in a certain format and print the same.
How can this be done?
Has anyone tried something like this?
Disclaimer: I have NOT tried the following solution myself.
There is no out-of-the-box support in Xamarin.Forms for printing PDF.
The best practice, in terms of safety and native-performance, would be to use Dependency Injection by defining an interface in the portable (CPL or .NET Standard) project and implementing the actual printing code in the native projects you wish to target.
The following are the APIs for their respective platforms:
For Android: https://developer.xamarin.com/api/type/Android.Print.Pdf.PrintedPdfDocument/
For iOS: https://developer.xamarin.com/api/type/MonoTouch.UIKit.UIPrintInteractionController/
More of the same:
https://www.syncfusion.com/kb/8767/how-to-print-pdf-documents-in-xamarin-forms-platform
Hope it helps. Cheers!

What is name for the effect of Mac OS's file panels expanded view?

Been trying to find similar component, have not yet find one. I want a component that basically able to expand an object to a panel next to it just like MacOS's file system. I wonder if anyone already know such exist and found it? Since I have no idea what this effect's name to start search from .
I am trying specifically, looking for a reactjs / pure js based visual component does it.
This type of view is known as Miller columns.
You're looking for NSBrowser.
It's kind of deprecated (Apple has never updated it to use views, so you still have to use cells). It's also idiosyncratic and has lots of undocumented behavior.
Enjoy ;)

IBM Worklight - Shell Component

When I have created a shell component, inside the shell component common folder there is folder called preview. I need to know what is the use of this folder. I am trying to understand about it using the following point specified in IBM modules.
preview: can be used to implement native functionality stubs for simulation in the Worklight Console preview instead of receiving exceptions
Still i am not having any clear idea about this. Can anyone give a clear idea about this.
Thanks in advance!
I believe that the main idea of the preview folder for shell component is to simulate its native behaviour, let's say for example you want to you the Google Maps API on a given area.
For the one developing the shell they do not have the final App, to test its behaviour. So, they can create some simulation such as a picture for a Map or a Picture of a Android TOAST, to allow them to work in the shell it self.

What is the cleanest way to set the environmental variable DYLD_FRAMEWORK_PATH for a release build?

I have custom frameworks in my app bundle for WebKit, WebCore, and JavaScriptCore. I would like all other frameworks that depend on the system versions of WebKit, WebCore, or JavaScriptCore to use my custom versions also. For instance my custom version of Webkit loads private system frameworks that in turn depend on the system version of WebKit. This means both my WebKit and the system WebKit get loaded, and usually a crash happens shortly after.
The way I understand this should be done, is to set the DYLD_FRAMEWORK_PATH environmental variable before your app bundle begins execution (Search order for loading frameworks can be found here: http://code.google.com/p/macdependency/wiki/SearchPaths). You can set environmental variables in code with setenv, but it won't take effect for the currently running process. I would have to re-launch the process again for it to take effect. I would like to avoid this too.
So my question is what is the best way to set the DYLD_FRAMEWORK_PATH before the execution of the my app bundle? This has to work in a release app bundle too. Is there a way to run a script whenever someone clicks on my app bundle before the executable starts running. Or is there any other suggestions out there?
Thanks in advance.
Jeff Wolski has the right idea by referring directly to Apple's documentation on the subject. This thread also provides excellent advice on how to get that going in Xcode, including corner cases associated with alternative methods of specification (for example, by using ~/.bash_profile directly for your user).
My reason for chiming in is you also asked for a script that might be able to assist you (and a bounty provider appears to have the same issue). It turns out Webkit references such a script in its documentation, which you might want to pick apart from the applicable Webkit source code. This should give you additional guidance on how, at least according to the developers, you should do this properly.
Best of luck with your project(s).
I would recommend environment.plist or the LSEnvironment key in the info.plist. Check out the link below.
https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html
WebKit currently has a script to do this for you, called run-webkit-app. See http://trac.webkit.org/browser/trunk/Tools/Scripts/run-webkit-app
Newer versions of ld understand the -dyld_env flag, which inserts a LC_DYLD_ENVIRONMENT load command into the binary (and as such applies essentially as early as possible in app execution). Perhaps adding -Wl,-dyld_env,DYLD_FRAMEWORK_PATH=/folder/encosing/WebKit/and/related/frameworks to your compiler flags might do what you want?

Resources