Skip to content
This repository has been archived by the owner on May 23, 2018. It is now read-only.

Commit

Permalink
Merge pull request #2 from recruit-lifestyle/feature/return_localized…
Browse files Browse the repository at this point in the history
…string

Feature/return localizedstring
  • Loading branch information
ykyouhei committed Oct 22, 2015
2 parents fbfcce7 + 4b258f5 commit a3575a6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions L.swift.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = 'L.swift'
s.version = '1.0.0'
s.version = '1.0.1'
s.summary = 'Use strong typed, autocompleted localized strings'
s.homepage = 'https://github.com/recruit-lifestyle/L.swift'
s.platform = :ios, '8.0'
s.author = { 'Yuki Nagai' => 'ynagai@r.recruit.co.jp' }
s.license = 'MIT'
s.source = { :http => 'https://github.com/recruit-lifestyle/L.swift/releases/download/1.0.0/lswift-1.0.0.zip' }
s.source = { :http => 'https://github.com/recruit-lifestyle/L.swift/releases/download/1.0.1/lswift-1.0.1.zip' }
s.preserve_paths = 'lswift'
end
8 changes: 7 additions & 1 deletion L.swift/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ private func main(arguments: [String]) {
// write file if we have changes
let fileName = "L.generated.swift"
let fileURL = directory.URLByAppendingPathComponent(fileName)
let contents = root.description
let imports = [
"import Foundation"
].joinWithSeparator("\n")
let contents = [
imports,
root.description
].joinWithSeparator("\n\n")
// compare with existing
let fileContents: String
do {
Expand Down
2 changes: 1 addition & 1 deletion L.swift/structures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ internal class Leaf {
}

func description(depth: Int = 0) -> String {
return "static let \(name) = \"\(key)\"".withSpaces(depth)
return "static let \(name) = NSLocalizedString(\"\(key)\", comment: \"\")".withSpaces(depth)
}
}

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# L.swift
![Pod Version](https://img.shields.io/cocoapods/v/L.swift.svg?style=flat)
![Pod License](https://img.shields.io/cocoapods/l/L.swift.svg?style=flat)
![Pod Platform](https://img.shields.io/cocoapods/p/L.swift.svg?style=flat)

Command line tool to get strong typed, autocompleted localized strings in Swift, inspired by [R.swift](https://github.com/mac-cain13/R.swift).

Expand All @@ -9,9 +12,9 @@ L.swift supports comma-separated keys.

|Key|L.swift|
|:---:|:---:|
|`"One"`|`NSLocalizedString(L.one, comment: "")`|
|`"One.Two"`|`NSLocalizedString(L.One.two, comment: "")`|
|`"One.Two.Three"`|`NSLocalizedString(L.One.Two.three, comment: "")`|
|`"One"`|`L.one (return NSLocalizedString("One", comment: "")`|
|`"One.Two"`|`L.One.two (return NSLocalizedString("L.One.Two", comment: "")`|
|`"One.Two.Three"`|`L.One.Two.three (return NSLocalizedString("L.One.Two.Three", comment: "")`|

## Installation

Expand Down

0 comments on commit a3575a6

Please sign in to comment.