-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
3967846
commit 424f217
Showing
14 changed files
with
205 additions
and
28 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
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
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
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,6 +1,6 @@ | ||
// swiftlint:disable all | ||
import Foundation | ||
struct Translations { | ||
public struct Translations { | ||
static let SOMETHING = NSLocalizedString("SOMETHING", comment: "") | ||
static let SOMETHING_ONLY_IN_EN = NSLocalizedString("SOMETHING_ONLY_IN_EN", comment: "") | ||
} |
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,4 +1,4 @@ | ||
// swiftlint:disable all | ||
import Foundation | ||
struct Translations { | ||
public struct Translations { | ||
} |
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
15 changes: 15 additions & 0 deletions
15
internal/translations/testdata/templated-ios-support/file.tmpl
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,15 @@ | ||
// swiftlint:disable all | ||
import Foundation | ||
struct Texts { | ||
static var bundle = Bundle.main | ||
{{- range . }} | ||
{{- if .Arguments }} | ||
static func {{ .Name }}({{ .Arguments }}) -> String { | ||
return NSLocalizedString("{{ .Name }}", bundle: bundle, comment: "{{ .Name }}") | ||
{{ .Replacements }} | ||
} | ||
{{- else }} | ||
static let {{ .Name }} = NSLocalizedString("{{ .Name }}", bundle: bundle, comment: "{{ .Name }}") | ||
{{- end }} | ||
{{- end }} | ||
} |
3 changes: 3 additions & 0 deletions
3
internal/translations/testdata/templated-ios-support/input.csv
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 @@ | ||
KEY,EN,DA | ||
SOMETHING,Something,Noget | ||
SOMETHING_WITH_ARGUMENTS,Something with %1 and %2,Noget med %1 og %2 |
16 changes: 16 additions & 0 deletions
16
internal/translations/testdata/templated-ios-support/invalid.tmpl
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,16 @@ | ||
{{ define content }} | ||
// swiftlint:disable all | ||
import Foundation | ||
struct Texts { | ||
static var bundle = Bundle.main | ||
{{- range . }} | ||
{{- if .Arguments }} | ||
static func {{ .Name }}({{ .Arguments }}) -> String { | ||
return NSLocalizedString("{{ .Name }}", bundle: bundle, comment: "{{ .Name }}") | ||
{{ .Replacements }} | ||
} | ||
{{- else }} | ||
static let {{ .Name }} = NSLocalizedString("{{ .Name }}", bundle: bundle, comment: "{{ .Name }}") | ||
{{- end }} | ||
{{- end }} | ||
} |
10 changes: 10 additions & 0 deletions
10
internal/translations/testdata/templated-ios-support/ios-swift.expected
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,10 @@ | ||
// swiftlint:disable all | ||
import Foundation | ||
struct Texts { | ||
static var bundle = Bundle.main | ||
static let SOMETHING = NSLocalizedString("SOMETHING", bundle: bundle, comment: "SOMETHING") | ||
static func SOMETHING_WITH_ARGUMENTS(_ p1: String, _ p2: String) -> String { | ||
return NSLocalizedString("SOMETHING_WITH_ARGUMENTS", bundle: bundle, comment: "SOMETHING_WITH_ARGUMENTS") | ||
.replacingOccurrences(of: "%1", with: p1).replacingOccurrences(of: "%2", with: p2) | ||
} | ||
} |