-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from nodes-ios/feature/IsDefaultValueFix
Is Default now set to fallback jsons
- Loading branch information
Showing
7 changed files
with
254 additions
and
3 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 |
---|---|---|
@@ -1 +1,143 @@ | ||
// ---------------------------------------------------------------------- | ||
// File generated by NStack Translations Generator. | ||
// | ||
// Copyright (c) 2018 Nodes ApS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ---------------------------------------------------------------------- | ||
|
||
import Foundation | ||
import TranslationManager | ||
|
||
public final class Translations: LocalizableModel { | ||
public var oneMoreSection = OneMoreSection() | ||
public var otherSection = OtherSection() | ||
public var defaultSection = DefaultSection() | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case oneMoreSection | ||
case otherSection | ||
case defaultSection = "default" | ||
} | ||
|
||
public override init() { super.init() } | ||
|
||
public required init(from decoder: Decoder) throws { | ||
super.init() | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
oneMoreSection = try container.decodeIfPresent(OneMoreSection.self, forKey: .oneMoreSection) ?? oneMoreSection | ||
otherSection = try container.decodeIfPresent(OtherSection.self, forKey: .otherSection) ?? otherSection | ||
defaultSection = try container.decodeIfPresent(DefaultSection.self, forKey: .defaultSection) ?? defaultSection | ||
} | ||
public override subscript(key: String) -> LocalizableSection? { | ||
switch key { | ||
case CodingKeys.oneMoreSection.stringValue: return oneMoreSection | ||
case CodingKeys.otherSection.stringValue: return otherSection | ||
case CodingKeys.defaultSection.stringValue: return defaultSection | ||
default: return nil | ||
} | ||
} | ||
|
||
public final class OneMoreSection: LocalizableSection { | ||
public var test2 = "" | ||
public var test1 = "" | ||
public var soManyKeys = "" | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case test2 | ||
case test1 | ||
case soManyKeys | ||
} | ||
|
||
public override init() { super.init() } | ||
|
||
public required init(from decoder: Decoder) throws { | ||
super.init() | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
test2 = try container.decodeIfPresent(String.self, forKey: .test2) ?? "__test2" | ||
test1 = try container.decodeIfPresent(String.self, forKey: .test1) ?? "__test1" | ||
soManyKeys = try container.decodeIfPresent(String.self, forKey: .soManyKeys) ?? "__soManyKeys" | ||
} | ||
|
||
public override subscript(key: String) -> String? { | ||
switch key { | ||
case CodingKeys.test2.stringValue: return test2 | ||
case CodingKeys.test1.stringValue: return test1 | ||
case CodingKeys.soManyKeys.stringValue: return soManyKeys | ||
default: return nil | ||
} | ||
} | ||
} | ||
|
||
public final class OtherSection: LocalizableSection { | ||
public var otherString = "" | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case otherString | ||
} | ||
|
||
public override init() { super.init() } | ||
|
||
public required init(from decoder: Decoder) throws { | ||
super.init() | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
otherString = try container.decodeIfPresent(String.self, forKey: .otherString) ?? "__otherString" | ||
} | ||
|
||
public override subscript(key: String) -> String? { | ||
switch key { | ||
case CodingKeys.otherString.stringValue: return otherString | ||
default: return nil | ||
} | ||
} | ||
} | ||
|
||
public final class DefaultSection: LocalizableSection { | ||
public var emptyKey = "" | ||
public var keyys = "" | ||
public var successKey = "" | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case emptyKey | ||
case keyys | ||
case successKey | ||
} | ||
|
||
public override init() { super.init() } | ||
|
||
public required init(from decoder: Decoder) throws { | ||
super.init() | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
emptyKey = try container.decodeIfPresent(String.self, forKey: .emptyKey) ?? "__emptyKey" | ||
keyys = try container.decodeIfPresent(String.self, forKey: .keyys) ?? "__keyys" | ||
successKey = try container.decodeIfPresent(String.self, forKey: .successKey) ?? "__successKey" | ||
} | ||
|
||
public override subscript(key: String) -> String? { | ||
switch key { | ||
case CodingKeys.emptyKey.stringValue: return emptyKey | ||
case CodingKeys.keyys.stringValue: return keyys | ||
case CodingKeys.successKey.stringValue: return successKey | ||
default: return nil | ||
} | ||
} | ||
} | ||
} | ||
|
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,31 @@ | ||
{ | ||
"data" : { | ||
"default" : { | ||
"emptyKey" : "__emptyKey", | ||
"keyys" : "danishKeyys", | ||
"successKey" : "DET VAR EN SUCCESS" | ||
}, | ||
"oneMoreSection" : { | ||
"soManyKeys" : "OrDanishValues", | ||
"test1" : "__test1", | ||
"test2" : "__test2" | ||
}, | ||
"otherSection" : { | ||
"otherString" : "Danish Haha" | ||
} | ||
}, | ||
"meta" : { | ||
"language" : { | ||
"direction" : "LRM", | ||
"id" : 6, | ||
"is_best_fit" : false, | ||
"is_default" : false, | ||
"locale" : "da-DK", | ||
"name" : "Danish" | ||
}, | ||
"platform" : { | ||
"id" : 24, | ||
"slug" : "mobile" | ||
} | ||
} | ||
} |
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,31 @@ | ||
{ | ||
"data" : { | ||
"default" : { | ||
"emptyKey" : "__emptyKey", | ||
"keyys" : "__keyys", | ||
"successKey" : "__successKey" | ||
}, | ||
"oneMoreSection" : { | ||
"soManyKeys" : "__soManyKeys", | ||
"test1" : "__test1", | ||
"test2" : "__test2" | ||
}, | ||
"otherSection" : { | ||
"otherString" : "__otherString" | ||
} | ||
}, | ||
"meta" : { | ||
"language" : { | ||
"direction" : "LRM", | ||
"id" : 9, | ||
"is_best_fit" : false, | ||
"is_default" : false, | ||
"locale" : "de-DE", | ||
"name" : "German (Germany)" | ||
}, | ||
"platform" : { | ||
"id" : 24, | ||
"slug" : "mobile" | ||
} | ||
} | ||
} |
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