Skip to content

Commit

Permalink
Version 0.9.0. Carthage support
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedya Levkin committed Jan 21, 2019
1 parent f9f8af5 commit 29df7ec
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 6 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 0.9.0 (21-01-2019)

### New

- Carthage support
- New `setProjectID:token:` method

### Behaviour changes

- `setAPIToken:projectID:` is deprecated and will be removed in the future

## 0.8.1 (04-01-2018)

### Fixes
Expand Down
122 changes: 122 additions & 0 deletions Lokalise.framework/Headers/Lokalise.h
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
40 changes: 40 additions & 0 deletions Lokalise.framework/Headers/LokaliseErrors.h
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

19 changes: 19 additions & 0 deletions Lokalise.framework/Headers/LokaliseLocalizationType.h
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 */
26 changes: 26 additions & 0 deletions Lokalise.framework/Info.plist
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 added Lokalise.framework/Lokalise
Binary file not shown.
5 changes: 5 additions & 0 deletions Lokalise.framework/Modules/module.modulemap
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"
}
4 changes: 2 additions & 2 deletions Lokalise.podspec
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
Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions LokaliseCarthage.json
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"
}
22 changes: 18 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,30 @@
- Xcode 8.3+
- iOS 8.0+

## Quick setup
## Setup

To install using CocoaPods simply add this line to your Podfile
### CocoaPods

To install using [CocoaPods](https://cocoapods.org) simply add this line to your Podfile

```
use_frameworks!
pod 'Lokalise', '~> 0.8.0'
pod 'Lokalise', '~> 0.9.0'
```

### Carthage

To install using [Carthage](https://github.com/Carthage/Carthage) simply add below line to your Cartfile

```
binary "https://raw.githubusercontent.com/lokalise/lokalise-ios-framework/master/LokaliseCarthage.json" ~> 0.9.0
```

If you would like to install manually, download Lokalise.framework and add it to your project and link c++ (libc++.tbd) and z (libz.tbd) libraries.
Link **c++ (libc++.tbd)** and **z (libz.tbd)** libraries to your targets.

### Manual

If you would like to install manually, download Lokalise.framework and add it to your project and link **c++ (libc++.tbd)** and **z (libz.tbd)** libraries.

## Getting started

Expand Down

0 comments on commit 29df7ec

Please sign in to comment.