-
Notifications
You must be signed in to change notification settings - Fork 7
Assets and localization
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'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.imageAll assets are generated to
Model/Generated/Assets.swift
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.titleWe 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
ACKLocalization generates Stringsdicts and using it is supereasy.
Continue to Dependency injection ➡️