Fix Stringium gneration when translation contains an =

This commit is contained in:
Thibaut Schmitt 2022-07-22 17:38:33 +02:00
parent ea833fbae7
commit 0775be88b0
15 changed files with 229 additions and 45 deletions

View File

@ -0,0 +1,21 @@
// Generated from ColorToolCore at 2022-07-22 15:38:00 +0000
import UIKit
extension UIColor {
/// Color red is #FF0000 (light) or #FF0000 (dark)"
static var red: UIColor {
UIColor(named: "red")!
}
/// Color green_alpha_50 is #A000FF00 (light) or #A000FF00 (dark)"
static var green_alpha_50: UIColor {
UIColor(named: "green_alpha_50")!
}
/// Color blue_light_dark is #0000FF (light) or #0000AA (dark)"
static var blue_light_dark: UIColor {
UIColor(named: "blue_light_dark")!
}
}

View File

@ -0,0 +1,62 @@
// Generated from FontToolCore
import UIKit
extension UIFont {
enum FontName: String {
case LatoItalic = "Lato-Italic"
case LatoLightItalic = "Lato-LightItalic"
case LatoHairline = "Lato-Hairline"
case LatoBold = "Lato-Bold"
case LatoBlack = "Lato-Black"
case LatoRegular = "Lato-Regular"
case LatoBlackItalic = "Lato-BlackItalic"
case LatoBoldItalic = "Lato-BoldItalic"
case LatoLight = "Lato-Light"
case LatoHairlineItalic = "Lato-HairlineItalic"
}
// MARK: - Getter
static let LatoItalic: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoItalic.rawValue, size: size)!
}
static let LatoLightItalic: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoLightItalic.rawValue, size: size)!
}
static let LatoHairline: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoHairline.rawValue, size: size)!
}
static let LatoBold: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoBold.rawValue, size: size)!
}
static let LatoBlack: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoBlack.rawValue, size: size)!
}
static let LatoRegular: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoRegular.rawValue, size: size)!
}
static let LatoBlackItalic: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoBlackItalic.rawValue, size: size)!
}
static let LatoBoldItalic: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoBoldItalic.rawValue, size: size)!
}
static let LatoLight: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoLight.rawValue, size: size)!
}
static let LatoHairlineItalic: ((_ size: CGFloat) -> UIFont) = { size in
UIFont(name: FontName.LatoHairlineItalic.rawValue, size: size)!
}
}

View File

@ -0,0 +1,32 @@
// Generated from Imagium at 2022-07-22 15:38:05 +0000
// Images from sampleImages
import UIKit
extension UIImage {
static var article_notification_pull_detail: UIImage {
UIImage(named: "article_notification_pull_detail")!
}
static var article_notification_pull: UIImage {
UIImage(named: "article_notification_pull")!
}
static var new_article: UIImage {
UIImage(named: "new_article")!
}
static var welcome_background: UIImage {
UIImage(named: "welcome_background")!
}
static var article_trash: UIImage {
UIImage(named: "article_trash")!
}
static var ic_close_article: UIImage {
UIImage(named: "ic_close_article")!
}
}

View File

@ -0,0 +1,65 @@
// Generated from Strings-Stringium at 2022-07-22 15:38:03 +0000
import UIKit
fileprivate let kStringsFileName = "sampleStrings"
extension String {
// MARK: - Webservice
/// Translation in en :
/// en
static var param_lang: String {
NSLocalizedString("param_lang", tableName: kStringsFileName, bundle: Bundle.main, value: "en", comment: "")
}
// MARK: - Generic
/// Translation in en :
/// Back
static var generic_back: String {
NSLocalizedString("generic_back", tableName: kStringsFileName, bundle: Bundle.main, value: "Back", comment: "")
}
/// Translation in en :
/// Loading data...
static var generic_loading_data: String {
NSLocalizedString("generic_loading_data", tableName: kStringsFileName, bundle: Bundle.main, value: "Loading data...", comment: "")
}
/// Translation in en :
/// Welcome \"%@\" !
static var generic_welcome_firstname_format: String {
NSLocalizedString("generic_welcome_firstname_format", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome \"%@\" !", comment: "")
}
/// Translation in en :
/// Welcome \"%@\" !
static func generic_welcome_firstname_format(arg0: String) -> String {
String(format: Self.generic_welcome_firstname_format, arg0)
}
// MARK: - EqualSymbol
/// Translation in en :
/// 1 = 1 point !
static var test_equal_symbol: String {
NSLocalizedString("test_equal_symbol", tableName: kStringsFileName, bundle: Bundle.main, value: "1€ = 1 point !", comment: "")
}
// MARK: - Placeholders
/// Translation in en :
/// You %%: %2$@ %1$@ Age: %3$d
static var placeholders_test_one: String {
NSLocalizedString("placeholders_test_one", tableName: kStringsFileName, bundle: Bundle.main, value: "You %%: %2$@ %1$@ Age: %3$d", comment: "")
}
/// Translation in en :
/// You %%: %2$@ %1$@ Age: %3$d
static func placeholders_test_one(arg0: String, arg1: String, arg2: Int) -> String {
String(format: Self.placeholders_test_one, arg0, arg1, arg2)
}
}

View File

@ -1,37 +0,0 @@
// Generated from Strings-Stringium at 2022-02-14 09:30:20 +0000
import UIKit
fileprivate let kStringsFileName = "sampleStrings"
extension String {
// MARK: - Webservice
/// Translation in en :
/// en
static var param_lang: String {
NSLocalizedString("param_lang", tableName: kStringsFileName, bundle: Bundle.main, value: "en", comment: "")
}
// MARK: - Generic
/// Translation in en :
/// Back
static var generic_back: String {
NSLocalizedString("generic_back", tableName: kStringsFileName, bundle: Bundle.main, value: "Back", comment: "")
}
/// Translation in en :
/// Loading data...
static var generic_loading_data: String {
NSLocalizedString("generic_loading_data", tableName: kStringsFileName, bundle: Bundle.main, value: "Loading data...", comment: "")
}
/// Translation in en :
/// Welcome \"%@\" !
static var generic_welcome_firstname_format: String {
NSLocalizedString("generic_welcome_firstname_format", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome \"%@\" !", comment: "")
}
}

View File

@ -18,6 +18,11 @@
"generic_welcome_firstname_format" = "Welcome \"%@\" !"; "generic_welcome_firstname_format" = "Welcome \"%@\" !";
/********** EqualSymbol **********/
"test_equal_symbol" = "1€ = 1 point !";
/********** Placeholders **********/ /********** Placeholders **********/
"placeholders_test_one" = "You %%: %2$@ %1$@ Age: %3$d"; "placeholders_test_one" = "You %%: %2$@ %1$@ Age: %3$d";

View File

@ -18,6 +18,11 @@
"generic_welcome_firstname_format" = "Welcome \"%@\" !"; "generic_welcome_firstname_format" = "Welcome \"%@\" !";
/********** EqualSymbol **********/
"test_equal_symbol" = "1€ = 1 point !";
/********** Placeholders **********/ /********** Placeholders **********/
"placeholders_test_one" = "You %%: %2$@ %1$@ Age: %3$d"; "placeholders_test_one" = "You %%: %2$@ %1$@ Age: %3$d";

View File

@ -18,6 +18,11 @@
"generic_welcome_firstname_format" = "Bienvenue \"%@\" !"; "generic_welcome_firstname_format" = "Bienvenue \"%@\" !";
/********** EqualSymbol **********/
"test_equal_symbol" = "1€ = 1 point !";
/********** Placeholders **********/ /********** Placeholders **********/
"placeholders_test_one" = "Vous %%: %1$@ %2$@ Age: %3$d"; "placeholders_test_one" = "Vous %%: %1$@ %2$@ Age: %3$d";

View File

@ -26,6 +26,14 @@
fr = Bienvenue "%@" ! fr = Bienvenue "%@" !
en-us = Welcome "%@" ! en-us = Welcome "%@" !
[[EqualSymbol]]
[test_equal_symbol]
en = 1€ = 1 point !
tags = droid,ios
comments =
fr = 1€ = 1 point !
en-us = 1€ = 1 point !
[[Placeholders]] [[Placeholders]]
[placeholders_test_one] [placeholders_test_one]
en = You %%: %2$@ %1$@ Age: %3$d en = You %%: %2$@ %1$@ Age: %3$d

View File

@ -0,0 +1,23 @@
// Generated from Strings-Tags at 2022-07-22 15:38:04 +0000
// typelias Tags = String
import UIKit
extension Tags {
// MARK: - ScreenTag
/// Translation in ium :
/// Ecran un
static var screen_one: String {
"Ecran un"
}
/// Translation in ium :
/// Ecran deux
static var screen_two: String {
"Ecran deux"
}
}

View File

@ -40,12 +40,7 @@ class TwineFileParser {
return return
} }
let rightElement: String = { let rightElement: String = splitLine.dropFirst().joined(separator: "=")
if let last = splitLine.last, splitLine.count == 2 {
return String(last)
}
return ""
}()
// "fr " => "fr" // "fr " => "fr"
let leftHand = String(leftElement).removeTrailingWhitespace() let leftHand = String(leftElement).removeTrailingWhitespace()