Skip to content

Assets and localization

Jakub Olejník edited this page Oct 1, 2020 · 7 revisions

If you look into our Podfile you can see a few pods which are not classic iOS pods as you may know them. Let's look at these 2 pods.

pod 'ACKLocalization'
pod 'SwiftGen'

Assets

Do you use UIImage(named: "icon") for embedding images or even new image literals? We use more safe and sexy approach - SwiftGen

Then you can handle images this way

imageView.image = Asset.icon.image

All assets are generated to Model/Generated/Assets.swift

Localization

We use a few tricks to localize our apps but under the hood it's just good old Localizable.strings 😌

All translated strings are downloaded from Google Spreadsheet with defined format via our tool ACKLocalization to Localizable.strings files. After that SwiftGen generates nice and error-proof enums which we use in the code.

So instead of

titleLabel.text = NSLocalizedString("order_list.title", comment: "")

we use

titleLabel.text = L10n.OrderList.title

Authentication

We cannot provide working service account for you, but authentication is required by Google Sheets API, that means that all calls to ACKLocalization will fail. To make it work, you need to provide your own service account or API key.

All localization enums are generated to Model/Generated/LocalizedStrings.swift

Pluralization

ACKLocalization generates Stringsdicts and using it is supereasy.


Continue to Dependency injection ➡️

Clone this wiki locally