-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fedya Levkin
committed
Jan 21, 2019
1 parent
f9f8af5
commit 29df7ec
Showing
10 changed files
with
246 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
// | ||
// Lokalise.h | ||
// Lokalise | ||
// | ||
// Created by Fjodors Levkins on 20/05/15. | ||
// Copyright (c) 2015 Lokalise SIA. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "LokaliseErrors.h" | ||
#import "LokaliseLocalizationType.h" | ||
|
||
@protocol LokaliseDelegate; | ||
|
||
extern NSString *__nonnull LokaliseFrameworkVersion; | ||
extern NSString *__nonnull LokaliseDidUpdateLocalizationNotification; | ||
|
||
@interface Lokalise : NSObject | ||
|
||
@property (class, readonly, strong) Lokalise *__nonnull sharedObject NS_SWIFT_NAME(shared); | ||
|
||
/** | ||
Lokalise SDK token. | ||
*/ | ||
@property (strong, nonatomic, readonly, nullable) NSString *token; | ||
|
||
/** | ||
Lokalise Project ID. | ||
*/ | ||
@property (strong, nonatomic, readonly, nullable) NSString *projectID; | ||
|
||
/** | ||
Set api token and project ID. | ||
@param projectID Project ID. | ||
@param token Lokalise SDK token. | ||
*/ | ||
- (void)setProjectID:(NSString *__nonnull)projectID token:(NSString *__nonnull)token; | ||
|
||
/** | ||
Set api token and project ID. | ||
@param apiToken Lokalise API Token. | ||
@param projectID Project ID. | ||
@deprecated Use [Lokalise.sharedObject setProjectId:projectId token:token] | ||
*/ | ||
- (void)setAPIToken:(NSString *__nonnull)apiToken projectID:(NSString *__nonnull)projectID __deprecated_msg("Use [Lokalise.sharedObject setProjectId:projectId token:token]"); | ||
|
||
/** | ||
Currently selected localization locale. | ||
*/ | ||
@property (strong, nonatomic, readonly, nonnull) NSLocale *localizationLocale; | ||
|
||
/** | ||
@return NSArray of NSLocale objects. Always has at least one locale. | ||
*/ | ||
- (NSArray <NSLocale *> *__nonnull)availableLocales; | ||
|
||
/** | ||
Sets localization locale which will be available right away. | ||
Can be set only to one of available locales. | ||
@param localizationLocale Locale from availableLocales array. | ||
@param makeDefault Application will remember selected locale if set to true. | ||
@param completionBlock Completion block where error is nil if locale is set. | ||
*/ | ||
- (void)setLocalizationLocale:(NSLocale *__nonnull)localizationLocale makeDefault:(BOOL)makeDefault completion:(void (^__nullable)(NSError *__nullable error))completionBlock; | ||
|
||
/** | ||
Current bundle version. 0 if bundle is not loaded or downloaded. | ||
*/ | ||
@property (nonatomic, readonly) NSInteger lokaliseBundleVersion; | ||
|
||
/** | ||
Determines what source is used for localization. | ||
Set to `LokaliseLocalizationRelease` by default. | ||
*/ | ||
@property (nonatomic) LokaliseLocalizationType localizationType; | ||
|
||
/** | ||
This method returns the following when key is nil or not found in table: | ||
- If key is nil and value is nil, returns an empty string. | ||
- If key is nil and value is non-nil, returns value. | ||
- If key is not found and value is nil or an empty string, returns key. | ||
- If key is not found and value is non-nil and not empty, return value. | ||
@param key The key for a string in the table identified by tableName. | ||
@param value The value to return if key is nil or if a localized string for key can’t be found in the table. | ||
@param tableName The receiver’s string table to search. If tableName is nil or is an empty string, the method attempts to use the table in Localizable.strings. | ||
@return A localized version of the string designated by key in table tableName. | ||
*/ | ||
- (NSString *__nonnull)localizedStringForKey:(NSString *__nonnull)key value:(NSString *__nullable)value table:(NSString *__nullable)tableName NS_FORMAT_ARGUMENT(1); | ||
|
||
/** | ||
Check if new localization version is available and downloads it. | ||
@param completionBlock Completion block where parameter `updated` is set to true if new bundle was downloaded and `error` which provides details if something went wrong. | ||
*/ | ||
- (void)checkForUpdatesWithCompletion:(void (^__nullable)(BOOL updated, NSError *__nullable error))completionBlock; | ||
|
||
/** | ||
Deletes all files downloaded by lokalise framework. | ||
*/ | ||
- (void)deleteLokaliseData; | ||
|
||
/** | ||
Forces [[NSBundle mainBundle] localizedStringForKey:key value:value table:tableName] to use [[Lokalise shareObject] localizedStringForKey:key value:value table:tableName]. | ||
*/ | ||
- (void)swizzleMainBundle; | ||
|
||
/** | ||
Deswizzles [[NSBundle mainBundle] localizedStringForKey:key value:value table:tableName]. | ||
*/ | ||
- (void)deswizzleMainBundle; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// LokaliseErrors.h | ||
// Lokalise | ||
// | ||
// Created by Fjodors Levkins on 21/05/15. | ||
// Copyright (c) 2015 Lokalise SIA. All rights reserved. | ||
// | ||
|
||
#ifndef Lokalise_LokaliseErrors_h | ||
#define Lokalise_LokaliseErrors_h | ||
|
||
/** | ||
Lokalise API error domain | ||
*/ | ||
static NSString *LKLAPIErrorDomain = @"lokalise.api.error"; | ||
|
||
/** | ||
Lokalise framework error domain | ||
*/ | ||
static NSString *LKLErrorDomain = @"lokalise.error"; | ||
|
||
typedef NS_ENUM(NSInteger, LokaliseErrorCode) { | ||
LokaliseErrorNoProjectData = 1, | ||
LokaliseErrorLocaleNotSupported, | ||
LokaliseErrorNoLokaliseFolder, | ||
LokaliseErrorNoLokaliseBundle, | ||
LokaliseErrorAlreadyUpdating, | ||
LokaliseErrorFailedToExtact, | ||
LokaliseErrorBadServerResponse, | ||
LokaliseErrorBadBundleLocation, | ||
LokaliseErrorBadServerBundleResponse, | ||
LokaliseErrorNoLocalBundleForLocale, | ||
LokaliseErrorNoLocalBundleForLocaleSwizzleDisabled, | ||
LokaliseErrorNoLokaliseBundleForLocale, | ||
LokaliseErrorNoUniqueIdentifier | ||
}; | ||
|
||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// LokaliseLocalizationType.h | ||
// Lokalise | ||
// | ||
// Created by Fedya Levkin on 04/04/2017. | ||
// Copyright © 2017 Lokalise SIA. All rights reserved. | ||
// | ||
|
||
#ifndef LokaliseLocalizationType_h | ||
#define LokaliseLocalizationType_h | ||
|
||
typedef NS_ENUM(NSInteger, LokaliseLocalizationType) { | ||
LokaliseLocalizationRelease = 0, | ||
LokaliseLocalizationPrerelease = 1, | ||
LokaliseLocalizationLocal = 2, | ||
LokaliseLocalizationDebug = 3 | ||
}; | ||
|
||
#endif /* LokaliseLocalizationType_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>DTSDKName</key> | ||
<string>iphoneos12.1</string> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>Lokalise</string> | ||
<key>CFBundleExecutable</key> | ||
<string>Lokalise</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>co.lokalise.ios-ota</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>Lokalise</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>0.9.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>0.9.0</string> | ||
</dict> | ||
</plist> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Lokalise { | ||
header "Headers/Lokalise.h" | ||
header "Headers/LokaliseErrors.h" | ||
header "Headers/LokaliseLocalizationType.h" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Pod::Spec.new do |s| | ||
|
||
s.name = "Lokalise" | ||
s.version = "0.8.1" | ||
s.version = "0.9.0" | ||
s.summary = "Lokalise framework for OTA localization for iOS." | ||
s.description = <<-DESC.gsub(/^ +\|/,'') | ||
|No need to resubmit your app for review to update strings or translations anymore | ||
|
@@ -14,7 +14,7 @@ Pod::Spec.new do |s| | |
s.homepage = "https://lokalise.co" | ||
s.license = { :type => "Custom", :file => 'LICENSE.md' } | ||
|
||
s.author = { "Fedya Levkin" => "[email protected]" } | ||
s.author = { "Fedya Levkin" => "[email protected]" } | ||
|
||
s.platform = :ios | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"0.9.0": "https://github.com/lokalise/lokalise-ios-framework/archive/0.9.0.zip" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters