Page tree
Skip to end of metadata
Go to start of metadata

Smartface allows you to support multiple languages in your app. Let’s take a look at how you can do it!

Adding New Language

Smartface is supporting the i18n adopting language system. “i18n.js” is available at i18n folder. When you open that file, you’ll see some language files added as a default. You can also add your own language with following steps;

  • Simply just duplicate one of the language .js files inside i18n folder.

  • Change the .js file as your new example.js file.

  • After you complete your ".js" file into i18n folder, you need to "include" that file in i18n.js file.

You can add two-letter ISO 639-1 standard language code after adding ‘case’ command into Language section.

Changing App Language

If you like change the app language, go to “i18n.js" script file and edit "SMF.i18n.switchLanguage();" function. For example; add “fi” for Finnish. However, for use the device language as default, just leave that string as “Device.language”. See example below;

 

In Use

lang array which is described in “i18n.js” is used for binding the keys of the language. Let's add two label into our projects which are getting text from lang array.

	var lbl1 = new SMF.UI.Label({
			name : "lbl1",
			left : "15%",
			top : "30%",
			width : "70%",
			height : "10%",
			text : lang.done
		});
	page1.add(lbl1);

	var lbl2 = new SMF.UI.Label({
			name : "lbl2",
			left : "15%",
			top : "50%",
			width : "70%",
			height : "10%",
			text : lang['cancel']
		});
	page1.add(lbl2);

AppStore Localization Settings

Smartface supports English by defaut. You can add another languages for App Store manually. Firstly publish your project for iOS and open the xCode project in your MAC.

Select Info Tab from “Smartface” Project. You can See “Localizations” segment in that window and press “+” to adding a new language.

After that it shows you the languages which you want to add just select one of them for example German.

Now, it shows you a popup window just press “Finish” Button.

Now you can see the German as a Localization String in your project.

This setting only required for App Store. It shows the supported languages by this way in the application description.