Internationalization

By default, Lock v2 for iOS displays all text in English. If you wish to display text in another language, or you wish to alter the text values for your application, you may provide a Lock.strings file and define values to be used for the various text items that Lock might display.

More information about how to handle languages can be found in the official Apple documentation on Internationalization and Localization

Lock String Values

For a full list of the terms used by Lock, see the base Lock.strings file in the Lock.swift repository.

Providing alternative English strings

If you want to change some or all of the existing terms, you can do this by downloading and adding the Lock.strings file to your project.

Select the Lock.strings file and in the File inspector click on Localize...

xcode localizable

Then select English:

xcode localizable

Now lets take a couple of terms in Lock.strings and update them with alternative text:

// Forgot password
"com.auth0.lock.database.button.forgot_password" = "Did you forget your password?";
// tos & privacy
"com.auth0.lock.database.button.tos" = "Signing up is an indication of your agreement to our terms of\n service and privacy policy";

Supporting other languages

To add another language you first of all need to add the new language under Project/Info

xcode add language

Add the new language and ensure that Lock.strings is selected

xcode add language

You will notice under Lock.strings a new file has been created for your specified language, based upon the the Reference Language selection.

Now you are ready to translate to your desired language.

Notes

Some terms use parameters and it's important to note their placement in your translation. In particular multiple parameter terms such as:

// No more than %@{count} identical characters in a row (e.g., \"%@{identical sample}\" not allowed)
"com.auth0.lock.error.password.no_more_identical" = "No more than %1$d identical characters in a row (e.g., \"%2$@\" not allowed)";