Start a Project

Easy Way to handle the String Localization & find the missing key in Localize string file using swift 4

String Localization & find the missing key in Localize string

Most of apps work on various languages , for  supporting the various languages we have to take Language string file of respective language .

Here i will provide the full information regarding

a: How to take this file and add to project.

b: Localized using small method.

c: Track all the missing key Value:

The Above “a”  point you can cover by  this blog:

Set Language translation (String localisation) in Swift

b: Write one Extension

 

Note: GlobalData.sharedInstance.language(key: self)

– this is method that will provide the corresponding key value from localize string file.

like home = “Home”;

Here is code Snippet :

It will return corresponding value;

Now its time to use this functionality:

Exam:

self.navigationItem.title = “applicationname”.localized

it will set the value of this key from string file –  “applicationname

Now we have to track which string are missing in file ,  for that we have to do some steps:

1: Open project and follow this:

2: Click on the edit scheme:

a:  Click on Arguments and set   –   “NSShowNonLocalizedStrings YES”

b:  Click on option and check on “Localization Debugging”

3: Now its time to Track the missing string in project , after setting all this things you have to just run this project :

Then you will got warning in debug window;

I have taken the example of this:

self.navigationItem.title = “applicationnamee”.localized

I did not localized this key in string file.

so I got warning like this:

 

 

 

 

 

 

 

 

 

 

 

 

 

Exit mobile version