Correction des commentaires des strings
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
This commit is contained in:
@ -84,26 +84,56 @@ class Definition {
|
||||
return (inputParameters: inputParameters, translationArguments: translationArguments)
|
||||
}
|
||||
|
||||
private func getBaseProperty(lang: String, translation: String, isStatic: Bool) -> String {
|
||||
"""
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
\(isStatic ? "static ": "")var \(name): String {
|
||||
NSLocalizedString("\(name)", tableName: kStringsFileName, bundle: Bundle.main, value: "\(translation)", comment: "")
|
||||
}
|
||||
"""
|
||||
private func getBaseProperty(lang: String, translation: String, isStatic: Bool, comment: String?) -> String {
|
||||
|
||||
if let comment, !comment.isEmpty {
|
||||
return
|
||||
"""
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
/// \(comment)
|
||||
\(isStatic ? "static ": "")var \(name): String {
|
||||
NSLocalizedString("\(name)", tableName: kStringsFileName, bundle: Bundle.main, value: "\(translation)", comment: "\(comment)")
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
return
|
||||
"""
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
\(isStatic ? "static ": "")var \(name): String {
|
||||
NSLocalizedString("\(name)", tableName: kStringsFileName, bundle: Bundle.main, value: "\(translation)", comment: "")
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
private func getBaseMethod(lang: String, translation: String, isStatic: Bool, inputParameters: [String], translationArguments: [String]) -> String {
|
||||
"""
|
||||
|
||||
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
\(isStatic ? "static ": "")func \(name)(\(inputParameters.joined(separator: ", "))) -> String {
|
||||
String(format: \(isStatic ? "Self" : "self").\(name), \(translationArguments.joined(separator: ", ")))
|
||||
}
|
||||
"""
|
||||
private func getBaseMethod(lang: String, translation: String, isStatic: Bool, inputParameters: [String], translationArguments: [String], comment: String?) -> String {
|
||||
|
||||
if let comment, !comment.isEmpty {
|
||||
return
|
||||
"""
|
||||
|
||||
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
/// \(comment)
|
||||
\(isStatic ? "static ": "")func \(name)(\(inputParameters.joined(separator: ", "))) -> String {
|
||||
String(format: \(isStatic ? "Self" : "self").\(name), \(translationArguments.joined(separator: ", ")))
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
return
|
||||
"""
|
||||
|
||||
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
\(isStatic ? "static ": "")func \(name)(\(inputParameters.joined(separator: ", "))) -> String {
|
||||
String(format: \(isStatic ? "Self" : "self").\(name), \(translationArguments.joined(separator: ", ")))
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
func getNSLocalizedStringProperty(forLang lang: String) -> String {
|
||||
@ -114,8 +144,13 @@ class Definition {
|
||||
}
|
||||
|
||||
// Generate property
|
||||
let property = getBaseProperty(lang: lang, translation: translation, isStatic: false)
|
||||
|
||||
let property = getBaseProperty(
|
||||
lang: lang,
|
||||
translation: translation,
|
||||
isStatic: false,
|
||||
comment: self.comment
|
||||
)
|
||||
|
||||
// Generate method
|
||||
var method = ""
|
||||
if let parameters = self.getStringParameters(input: translation) {
|
||||
@ -123,7 +158,8 @@ class Definition {
|
||||
translation: translation,
|
||||
isStatic: false,
|
||||
inputParameters: parameters.inputParameters,
|
||||
translationArguments: parameters.translationArguments)
|
||||
translationArguments: parameters.translationArguments,
|
||||
comment: self.comment)
|
||||
}
|
||||
|
||||
return property + method
|
||||
@ -137,7 +173,12 @@ class Definition {
|
||||
}
|
||||
|
||||
// Generate property
|
||||
let property = getBaseProperty(lang: lang, translation: translation, isStatic: true)
|
||||
let property = getBaseProperty(
|
||||
lang: lang,
|
||||
translation: translation,
|
||||
isStatic: true,
|
||||
comment: self.comment
|
||||
)
|
||||
|
||||
// Generate method
|
||||
var method = ""
|
||||
@ -146,7 +187,8 @@ class Definition {
|
||||
translation: translation,
|
||||
isStatic: true,
|
||||
inputParameters: parameters.inputParameters,
|
||||
translationArguments: parameters.translationArguments)
|
||||
translationArguments: parameters.translationArguments,
|
||||
comment: self.comment)
|
||||
}
|
||||
|
||||
return property + method
|
||||
@ -160,7 +202,18 @@ class Definition {
|
||||
print(error.description)
|
||||
Stringium.exit(withError: error)
|
||||
}
|
||||
|
||||
|
||||
if let comment, !comment.isEmpty {
|
||||
return """
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
/// \(comment)
|
||||
var \(name): String {
|
||||
"\(translation)"
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
return """
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
@ -177,6 +230,17 @@ class Definition {
|
||||
Stringium.exit(withError: error)
|
||||
}
|
||||
|
||||
if let comment, !comment.isEmpty {
|
||||
return """
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
/// \(comment)
|
||||
static var \(name): String {
|
||||
"\(translation)"
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
return """
|
||||
/// Translation in \(lang) :
|
||||
/// \(translation)
|
||||
|
Reference in New Issue
Block a user