Skip to content

Commit b994d52

Browse files
authored
Merge pull request #1027 from oxen-io/dev
Release 2.8.0
2 parents 83ec937 + a1c3d53 commit b994d52

File tree

231 files changed

+392552
-52179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+392552
-52179
lines changed

Scripts/EmojiGenerator.swift

+28-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,33 @@ enum RemoteModel {
5252
case symbols = "Symbols"
5353
case flags = "Flags"
5454
case components = "Component"
55+
56+
var localizedKey: String = {
57+
switch self {
58+
case .smileys:
59+
return "Smileys"
60+
case .people:
61+
return "People"
62+
case .smileysAndPeople:
63+
return "Smileys"
64+
case .animals:
65+
return "Animals"
66+
case .food:
67+
return "Food"
68+
case .activities:
69+
return "Activities"
70+
case .travel:
71+
return "Travel"
72+
case .objects:
73+
return "Objects"
74+
case .symbols:
75+
return "Symbols"
76+
case .flags:
77+
return "Flags"
78+
case .components:
79+
return "Component"
80+
}
81+
}()
5582
}
5683

5784
static func fetchEmojiData() throws -> Data {
@@ -551,7 +578,7 @@ extension EmojiGenerator {
551578
for category in outputCategories {
552579
fileHandle.writeLine("case .\(category):")
553580
fileHandle.indent {
554-
let stringKey = "EMOJI_CATEGORY_\("\(category)".uppercased())_NAME"
581+
let stringKey = "emojiCategory\(category.localizedKey)"
555582
let stringComment = "The name for the emoji category '\(category.rawValue)'"
556583

557584
fileHandle.writeLine("return NSLocalizedString(\"\(stringKey)\", comment: \"\(stringComment)\")")

Scripts/LintLocalizableStrings.swift

+155-107
Large diffs are not rendered by default.

Scripts/ProcessIP2CountryData.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,19 @@ class Processor {
126126
guard keepRunning else { return }
127127

128128
/// Filter down the files to find the country name files
129-
let localisedCountryNameFileUrls: [URL] = fileUrls.filter { fileUrl in
129+
let localizedCountryNameFileUrls: [URL] = fileUrls.filter { fileUrl in
130130
((try? fileUrl.resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory == false) &&
131131
fileUrl.lastPathComponent.lowercased().hasPrefix(countryNameFilePrefix.lowercased()) &&
132132
fileUrl.lastPathComponent.lowercased().hasSuffix(".csv")
133133
}
134134

135135
guard keepRunning else { return }
136136

137-
let languageCodes: String = localisedCountryNameFileUrls
137+
let languageCodes: String = localizedCountryNameFileUrls
138138
.map { url in String(url.lastPathComponent.dropFirst(countryNameFilePrefix.count).dropLast(".csv".count)) }
139139
.sorted()
140140
.joined(separator: ", ")
141-
print("Found \(localisedCountryNameFileUrls.count) language files ✅ (\(languageCodes))")
141+
print("Found \(localizedCountryNameFileUrls.count) language files ✅ (\(languageCodes))")
142142

143143
guard keepRunning else { return }
144144

@@ -184,16 +184,16 @@ class Processor {
184184

185185
/// Structure of the data should be `geoname_id,locale_code,continent_code,continent_name,country_iso_code,country_name,is_in_european_union`
186186
let languagesPrefix: String = "Processing languages: "
187-
localisedCountryNameFileUrls.enumerated().forEach { fileIndex, fileUrl in
187+
localizedCountryNameFileUrls.enumerated().forEach { fileIndex, fileUrl in
188188
guard keepRunning else { return }
189189
guard
190-
let localisedData: Data = try? Data(contentsOf: fileUrl),
191-
let localisedDataString: String = String(data: localisedData, encoding: .utf8)
192-
else { fatalError("Could not load localised country name file") }
190+
let localizedData: Data = try? Data(contentsOf: fileUrl),
191+
let localizedDataString: String = String(data: localizedData, encoding: .utf8)
192+
else { fatalError("Could not load localized country name file") }
193193

194194
/// Header line plus at least one line of content
195-
let lines: [String] = localisedDataString.components(separatedBy: "\n")
196-
guard lines.count > 1 else { fatalError("Localised country file had no content") }
195+
let lines: [String] = localizedDataString.components(separatedBy: "\n")
196+
guard lines.count > 1 else { fatalError("localized country file had no content") }
197197

198198
lines[1...].enumerated().forEach { index, line in
199199
let values: [String] = parseCsvLine(line.trimmingCharacters(in: .whitespacesAndNewlines))
@@ -203,7 +203,7 @@ class Processor {
203203
cache.countryLocationsGeonameId.append(values[0])
204204
cache.countryLocationsCountryName.append(values[5].trimmingCharacters(in: CharacterSet(charactersIn: "\"")))
205205

206-
let progress = (Double((fileIndex * lines.count) + index) / Double(localisedCountryNameFileUrls.count * lines.count))
206+
let progress = (Double((fileIndex * lines.count) + index) / Double(localizedCountryNameFileUrls.count * lines.count))
207207
printProgressBar(prefix: languagesPrefix, progress: progress, total: (terminalWidth - 10))
208208
}
209209
}

0 commit comments

Comments
 (0)