Add Language
Follow below video to add language in the Car Dealer iOS Application.
To add language to the CarDealer iOS application follow below steps;
- Open the CarDealaer iOS application in Xcode.
- Now open
Languages
folder in../CarDealerApp/HelperClasses/
. Here all the languages are available that are already in the CarDealer iOS application. - Right click on
en.json
file and click on Show in Finder button. - Copy
en.json
file. - Paste file on any location on your system.
- Change file name from en to any langauage that you want, as shown in the image below.
- Now drag and drop the file with changed name to the
Language
folder, then one popup is shown as shown in the image. Click on Finish button.
Note: Make sure that Copy item if needed is marked as well as Create groups in Added folder option. and Add to targets must be marked.
- Now the file is added to the folder
Language
. Open the file you have added to the Xcode. - Change each and every value with the language that you want to add. Suppose you want to add Chinese to the CarDealer App then change all the values with the Chinese equevelent words, as shown in the Image below.
- Now open
AppDelegate.swift
file and search forsetLanguageData()
method. - Copy code
MCLocalization.sharedInstance.addProvider(MCLocalization.JSONProvider(language: "en", fileName: "en.json"))
and paste it below the last line, as shown in image. - Change file name with the file name that we have added to the CarDealer App.
- Open https://make.wordpress.org/polyglots/teams/ link. Here all the codes which are preferred by WordPress is listed.
- Select language that you want to add in your App. For example we are adding Chinese language so select chinese WP Locale language code and copy language code for chinese language i.e “zh_CN”.
- Now open the CarDealer iOS app in Xcode, and open
AppDelegate.swift
file and go tosetLanguageData()
method. Now paste language code into the code that we added to add new language file insetLanguageData()
method.
Note: If the code that we have added in
setLanguageData()
method is having"_"(Under Score) then replace it with "-"(dash), as shown in the Image. - Now new language is added to the CarDealer iOS Applicaiton