Skip to content

Commit

Permalink
Group files
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkowz committed Jul 21, 2015
1 parent 5315ca6 commit f1582e2
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 54 deletions.
110 changes: 75 additions & 35 deletions Swifternalization.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

12 changes: 0 additions & 12 deletions Swifternalization/Expression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@

import Foundation

/// Supported expression types
enum ExpressionType: String {
/// works on Int only, e.g. `x<5`, `x=3`
case Inequality = "ie"

/// works on Int only, e.g. `4<x<10`, `1<=x<18`
case InequalityExtended = "iex"

/// regular expression, e.g. `[02-9]+`
case Regex = "exp"
}

/// String that contains expression pattern, e.g. `ie:x<5`, `exp:^1$`.
internal typealias ExpressionPattern = String

Expand Down
21 changes: 21 additions & 0 deletions Swifternalization/ExpressionType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// ExpressionType.swift
// Swifternalization
//
// Created by Tomasz Szulc on 21/07/15.
// Copyright (c) 2015 Tomasz Szulc. All rights reserved.
//

import Foundation

/// Supported expression types
enum ExpressionType: String {
/// works on Int only, e.g. `x<5`, `x=3`
case Inequality = "ie"

/// works on Int only, e.g. `4<x<10`, `1<=x<18`
case InequalityExtended = "iex"

/// regular expression, e.g. `[02-9]+`
case Regex = "exp"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// KeyValue.swift
// KeyValueType.swift
// Swifternalization
//
// Created by Tomasz Szulc on 28/06/15.
Expand All @@ -21,7 +21,7 @@ internal typealias KVDict = Dictionary<Key, Value>
Protocol that defines properties and methods that need to be implemented by
objects that keeps key-value pair things.
*/
protocol KeyValue {
protocol KeyValueType {
/// A key.
var key: Key {get set}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
/**
Represents translation which contains expressions that are not processed yet.
*/
struct ProcessableTranslation: TranslationType, Processable {
struct ProcessableTranslationExpression: TranslationType, Processable {
/// Key that identifies translation.
let key: String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
/**
Represents translation which contains expressions with length variations.
*/
struct ProcessableTranslationLengthVariationExpression: TranslationType, Processable {
struct ProcessableTranslationExpressionLengthVariationExpression: TranslationType, Processable {
/// Key that identifies translation.
let key: String

Expand Down
2 changes: 1 addition & 1 deletion Swifternalization/TranslatablePair.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Represents key-value pair from Localizable.strings files.
It contains key, value and expression if exists for the key.
It can also validate if text matches expression's requirements.
*/
struct TranslatablePair: KeyValue {
struct TranslatablePair: KeyValueType {
/// Key from Localizable.strings.
var key: Key

Expand Down
4 changes: 2 additions & 2 deletions Swifternalization/TranslationsLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ final class TranslationsLoader: JSONFileLoader {

case .TranslationWithLoadedExpressions:
let expressions = parseExpressions(dictionary as! DictWithStrings)
loadedTranslations.append(ProcessableTranslation(key: translationKey, loadedExpressions: expressions))
loadedTranslations.append(ProcessableTranslationExpression(key: translationKey, loadedExpressions: expressions))

case .TranslationWithLengthVariationsAndLoadedExpressions:
var expressions = [ProcessableLengthVariationExpression]()
for (expressionIdentifier, lengthVariationsDict) in dictionary as! DictWithDicts {
let variations = parseLengthVariations(lengthVariationsDict)
expressions.append(ProcessableLengthVariationExpression(identifier: expressionIdentifier, variations: variations))
}
loadedTranslations.append(ProcessableTranslationLengthVariationExpression(key: translationKey, expressions: expressions))
loadedTranslations.append(ProcessableTranslationExpressionLengthVariationExpression(key: translationKey, expressions: expressions))

case .NotSupported:
// Do nothing
Expand Down

0 comments on commit f1582e2

Please sign in to comment.