Skip to content

Commit

Permalink
Add English localization
Browse files Browse the repository at this point in the history
  • Loading branch information
peblair committed May 13, 2021
1 parent 012e34a commit fe4c1d4
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 10 deletions.
5 changes: 5 additions & 0 deletions ViteMaDose.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@
57FE5C0E261FA84D0012B66D /* UIColor+VideMaDose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+VideMaDose.swift"; sourceTree = "<group>"; };
6A28354B262DC06C00FA6456 /* ViteMaDose.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ViteMaDose.entitlements; sourceTree = "<group>"; };
889B9A49263307EC00175E24 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
A17FECFE264D301E0044E034 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
A17FECFF264D301F0044E034 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
DA234DC22626494600D6F71C /* remote-configuration.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "remote-configuration.plist"; sourceTree = "<group>"; };
DA234DD02626506600D6F71C /* RemoteConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteConfig.swift; sourceTree = "<group>"; };
DA4D9952261E6B6A00D28AD0 /* LocationSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSearchViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -662,6 +664,7 @@
knownRegions = (
fr,
Base,
en,
);
mainGroup = 576738B3261E329C004A700D;
packageReferences = (
Expand Down Expand Up @@ -932,6 +935,7 @@
isa = PBXVariantGroup;
children = (
57B2BCA42633B254001B3D61 /* fr */,
A17FECFE264D301E0044E034 /* en */,
);
name = Localizable.strings;
sourceTree = "<group>";
Expand All @@ -940,6 +944,7 @@
isa = PBXVariantGroup;
children = (
57DEAA04263444BB005E8628 /* fr */,
A17FECFF264D301F0044E034 /* en */,
);
name = Localizable.stringsdict;
sourceTree = "<group>";
Expand Down
11 changes: 7 additions & 4 deletions ViteMaDose/Models/VaccinationCentre.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,18 @@ extension VaccinationCentre {
}

var nextAppointmentDate: Date? {
return prochainRdv?.toDate(nil, region: AppConstant.franceRegion)?.date ?? prochainRdv?.toISODate(nil, region: AppConstant.franceRegion)?.date
return prochainRdv?.toDate(nil, region: Region.current)?.date ?? prochainRdv?.toISODate(nil, region: Region.current)?.date
}

var nextAppointmentDay: String? {
return prochainRdv?.toString(with: .date(.long), region: AppConstant.franceRegion)
// Don't display year
// [TODO] Technically an en_US locale should do "MMM dd" instead
return prochainRdv?.toString(with: .custom("dd MMM"), region: Region.current)
}

var nextAppointmentTime: String? {
return prochainRdv?.toString(with: .time(.short), region: AppConstant.franceRegion)
// Avoid AM/PM in English locale
return prochainRdv?.toString(with: .custom("HH:mm"), region: Region.current)
}

var appointmentUrl: URL? {
Expand Down Expand Up @@ -176,7 +179,7 @@ struct VaccinationCentres: Codable, Hashable {
}

var formattedLastUpdated: String? {
guard let lastUpdateDate = lastUpdated?.toDate(nil, region: AppConstant.franceRegion) else {
guard let lastUpdateDate = lastUpdated?.toDate(nil, region: Region.current) else {
return nil
}

Expand Down
5 changes: 0 additions & 5 deletions ViteMaDose/Resources/AppConstant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,4 @@ import Foundation
import SwiftDate

enum AppConstant {
static let franceRegion = Region(
calendar: Calendar.current,
zone: Zones.current,
locale: Locale(identifier: "fr_FR")
)
}
2 changes: 1 addition & 1 deletion ViteMaDose/Resources/Localization/Localization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum Localization {
}

enum LocationSearch {
static let search_placeholder = "Commune, Code Postal, Département...".localized
static let search_placeholder = "location_search.search_placeholder".localized

enum MainTitle {
static let title = "location_search.main_title".localized
Expand Down
46 changes: 46 additions & 0 deletions ViteMaDose/Resources/Localization/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Localizable.strings
ViteMaDose

Created by Philip Blair on 12/05/2021.

*/

// Home
"home.main_title" = "Find a vaccine quickly and easily";
"home.main_title.first_highlighted_text" = "quickly";
"home.main_title.second_highlighted_text" = "easily";
"home.search_placeholder" = "Search...";
"home.last_stats" = "Latest statistics...";
"home.open_map" = "See locations on the map";
"home.partners" = "Find your appointments with";
"home.stats.all_locations" = "Locations found in France";
"home.stats.all_availabilities" = "Appointments available";
"home.stats.locations_with_availabilities" = "Locations with available appointments";
"home.stats.available_locations_percentage" = "Of locations have availabilities";
// Department Selection
"location_search.main_title" = "Select or search for a location in France";
"location_search.main_title.highlighted_text" = "France";
"location_search.search_placeholder" = "Commune, Postal Code, Department...";
// Locations
"locations.list_title" = "List of locations";
"locations.no_results" = "We have not found any appointments for %@";
"locations.sort_option.closest" = "Closest";
"locations.sort_option.fastest" = "Available soonest";
// Location
"location.date" = "On %@ at %@";
"location.book_button" = "Book an appointment";
"location.verify_button" = "Check with this location";
"location.last_update" = "Last updated on %@ at %@";
"location.no_appointment" = "No appointments";
"location.open_route" = "Show route";
"location.unavailable_date" = "Date unavailable";
"location.unavailable_name" = "Name of location unavailable";
"location.unavailable_address" = "Address unavailable";
// Error
"error.generic.title" = "Oops! We're having some technical difficulties...";
"error.generic.retry_button" = "Retry";
"error.generic.cancel_button" = "Cancel";
"error.generic.default_message" = "If the problem persists, please contact the team at https://covidtracker.fr/contact";
"error.network.server_error" = "We've encountered a server error. Please try again later.";
"error.network.offline" = "You appear to be offline.";
112 changes: 112 additions & 0 deletions ViteMaDose/Resources/Localization/en.lproj/Localizable.stringsdict
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>locations.available_locations</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count@</string>
<key>count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>zero</key>
<string>Locations with appointments</string>
<key>one</key>
<string>Location with appointments</string>
<key>other</key>
<string>Locations with appointments</string>
</dict>
</dict>
<key>locations.all_locations</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count@</string>
<key>count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>zero</key>
<string>Total locations found</string>
<key>one</key>
<string>Total location found</string>
<key>other</key>
<string>Total locations found</string>
</dict>
</dict>
<key>locations.appointments</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count@</string>
<key>count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>zero</key>
<string>%d appointments</string>
<key>one</key>
<string>%d appointment</string>
<key>other</key>
<string>%d appointments</string>
</dict>
</dict>
<key>locations.main_title_department</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count@</string>
<key>count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>We have found %d appointment for %@</string>
<key>other</key>
<string>We have found %d appointments for %@</string>
</dict>
</dict>
<key>locations.main_title_city</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count@</string>
<key>count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>We have found %d appointment near %@</string>
<key>other</key>
<string>We have found %d appointments near %@</string>
</dict>
</dict>
<key>home.recent_search</key>
<dict>
<key>New item</key>
<string></string>
<key>NSStringLocalizedFormatKey</key>
<string>%#@count@</string>
<key>count</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>zero</key>
<string>Recent searches</string>
<key>one</key>
<string>Recent search</string>
<key>other</key>
<string>Recent searches</string>
</dict>
</dict>
</dict>
</plist>

0 comments on commit fe4c1d4

Please sign in to comment.