Skip to content

Commit

Permalink
Make parameters having order numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Wayne Wanbok Choi committed Jul 21, 2022
1 parent 6e73ac4 commit c9b389c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Sources/POEditorParser/Lib/LiteralsParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,22 @@ public struct Translation {
return ""
}
*/
let parameters = variables
let uniqueKeyVariables: [Variable] = {
guard variables.count > 1 else {
return variables
}

return variables
.enumerated()
.map { (index, variable) in
return .init(rawKey: variable.rawKey + "\(index)")
}
}()

let parameters = uniqueKeyVariables
.map { $0.type.swiftParameter(key: $0.parameterKey) }
.joined(separator: ", ")
let localizedArguments = variables
let localizedArguments = uniqueKeyVariables
.map { $0.parameterKey }
.map { $0.snakeCased() }
.joined(separator: ", ")
Expand Down

0 comments on commit c9b389c

Please sign in to comment.