lwuit change language and apply it - internationalization

I have a form to change language of my j2me application. This application is created by codenameone.
I create a class and I write all my words into it in 2 language English and Farsi. I change the language with this code:
UIManager.getInstance().setResourceBundle(new CommonSettings().getFarsi());
How can I apply this language to all components of this form lively or without exit from this form?

You need to recreate the form. The GUI builder can do this automatically for you if you invoke the method reloadForm() in the state machine.

Related

Changing sap ui5 application locale dynamically in the application

I have two different language i.e English and German in my web app and user can change the language in application through a select box. Initially i am getting preferred language from the back-end and i am setting locale of the core as follows.
sap.ui.getCore().getConfiguration().setLanguage("//according to whatever is coming from back-end")
Now lets say initial language is English, if user open a control i.e sap.m.datepicker, calendar is being displayed in English. If user changes the language to German from the application i am again changing the language in the core as shown below:
sap.ui.getCore().getConfiguration().setLanguage("de-DE")
Now if user opens that same datepicker, it is being displayed in English instead of German and if user opens some another control or datepicker it is being rendered in German.
Page is not getting refreshed while changing the language in app.
Please suggest me a solution to dynamically change the locale of the controls.
Maybe my answer here helps a little.
The problem is that in many cases, maybe even in most cases, the standard UI5 controls detect the language only once when they get loaded. Very often, the control developers did not implement a "dynamic change" of the language. If you check the link I mentioned above you will see that there are ways to react on language changes, but very often this is not implemented for whatever reason.
However, I'm afraid to tell you that in your case the standard control might not support dynamic language changes out of the box (but I did not check the code). Also, it seems that the UI5 guys at SAP do not consider this as a bug (see this github issue). Such a pity...
I would suggest you use sap.ui.core.Core.attachLocalizationChanged(fnFunction, oListener) and add this to the onInit function of your controller.
From this, in your fnFunction rebuild the controls where you require the locale changes to be dynamic.
example:
onInit: function(oEvent) {
sap.ui.getCore().attachLocalizationChanged(this._handleLocalizationChanged, this);
},
_handleLocalizationChanged: function() {
// ... Some logic to re-build / set locale for the dynamic controls.
}
This is my interpretation of what should be done based on the information in the api

how to add file chooser to swing GUI form Palette components IntelliJ IDEA

I already developed an application that train some text files in order to creat a data model which i will use in another class to identify the language of the document.
For now i have written and finished writing two classes one for Training the data models and the other to identify any given document language.
I wrote the code that i can get the file paths as arguments to my main method in order for the user to pass the file names as arguments to my main method.
But now i decided to create a simple GUI form for the application and i need the file chooser But when i choose the GUI form i could not find the file chooser from all the Swing palette components available.
How can i add it?
Note: i am using IntelliJ IDEA 13.0 Ultimate.
File chooser is something that usually pops up based on some button click.
So, what can you do is, inside button listener make an object JFileChooser and play with that.
fc = new JFileChooser();
fc.showOpenDialog(parentPanel);

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.

lazarus gui main menu using forms?

i need to make a form where when a button is clicked then another form/page opens and from that for you can return to the original form in a similar fashion a main menu/sub menu works.
sorry im new to object pascal
Simply add the second form, and then in the button handler do a
secondform.showmodal;
Don't forget to add the unit where "Secondform" is in to the uses clauses of the first unit.
At the FreePascal Wiki you will find a tutorial on how to use Lazarus. You can read it in several different languages.
You can also see this Developing a GUI Application tutorial.

Loading VB forms/UserControls into ActiveX control

I have developed an ActiveX control in VB 6.0. I have a placeholder in my ActiveX control, where I need to load a user control developed in VB 6.0 at runtime. The user control has to be part of another DLL/OCX file.
How do I load the user control in VB dynamically?
All the user controls have some common functionalities. Can I implement the common functionalities in the base class and write only specific code in user control?
You can load the control like any other control, using CreateObject. Then you have to assign the control as a child control to your container. (In a standard VB6 form you can do this with Controls.Add. (See this))
This is possible only to a certain degree. COM/ActiveX is all about composition, there's no inheritance. You could create a helper class which provides the common functionality and is instanciated and used by the user controls.

Resources