Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GT 2407 add amharic app language #2209

Closed
wants to merge 76 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
8803430
Remove publisher as argument in use case
levieggertcru May 6, 2024
e937690
Merge branch 'master' into feature/app-languages-feature-release-2.0
levieggertcru May 6, 2024
b6c4174
Remove LanguageSettingsRepository as we've moved to the app language …
levieggertcru May 6, 2024
d534a56
Merge pull request #2093 from CruGlobal/GT-remove-deprecated-language…
levieggertcru May 6, 2024
6d74c6d
Merge pull request #2091 from CruGlobal/GT-remove-publisher-argument-…
levieggertcru May 6, 2024
81e4bb1
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 6, 2024
6e68ac0
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 9, 2024
6883237
Add sync invalidator to help manage when a new sync should take place…
levieggertcru May 9, 2024
44e9c75
Add realm cache to app languages repository
levieggertcru May 9, 2024
1fc40c8
Add prepend to observe changes which will trigger this when subscribed
levieggertcru May 9, 2024
74d032b
Update tests to include number of app languages
levieggertcru May 9, 2024
a7e382d
Remove method to fetch realm cache and use publisher on repository to…
levieggertcru May 9, 2024
81ecbfd
Add extension to delete objects by primary keys with realm argument
levieggertcru May 9, 2024
91ece7f
Update MockAppLanguagesRepositorySync to take argument of app languages
levieggertcru May 9, 2024
ec8fd26
Merge pull request #2098 from CruGlobal/GT-2371-add-realm-cache-for-a…
levieggertcru May 10, 2024
35c6016
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 10, 2024
971e922
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 13, 2024
c3fce60
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 14, 2024
10cf896
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 16, 2024
c7917bb
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 16, 2024
428a67b
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 20, 2024
eecc470
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 21, 2024
237c074
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 21, 2024
5023b69
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 22, 2024
60156e1
use default language for category translation if tool doesn't support…
rachaelblue May 29, 2024
e74ead7
download default translation if app language translation not available
rachaelblue May 29, 2024
4b0e6ff
get numeral languageId rather than using locale/languageCode
rachaelblue May 29, 2024
cb310ec
actually commit languageId change
rachaelblue May 29, 2024
341a424
use default translation as fallback for for tool details
rachaelblue May 29, 2024
f888833
remove spaces
rachaelblue May 29, 2024
e64c600
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 30, 2024
4a775b2
create use case for persisting tool settings
rachaelblue May 31, 2024
be57eca
Merge branch 'feature/app-languages-feature-release-2.0' of https://g…
rachaelblue May 31, 2024
faf81ff
use tool default language translation on tool version card title
rachaelblue May 31, 2024
b65da91
Merge pull request #2148 from CruGlobal/GT-2266-Default-Tool-Language
rachaelblue May 31, 2024
bbe1c9b
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru May 31, 2024
4db4ee3
persist tool language setting updates
rachaelblue Jun 4, 2024
1bfedc1
add use case stubs for getting user tool settings
rachaelblue Jun 4, 2024
e58cb14
add get user tool settings repo
rachaelblue Jun 4, 2024
c31a76d
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru Jun 4, 2024
499ffb4
rename toolSettings persistence classes to "UserToolSettings"
rachaelblue Jun 4, 2024
dbe6fbd
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru Jun 5, 2024
5a7f4cc
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru Jun 7, 2024
00ea5d3
Lock file maintenance
renovate[bot] Jun 10, 2024
34ec13e
Merge branch 'master' into feature/app-languages-feature-release-2.0
levieggertcru Jun 10, 2024
f8aa8bb
Merge pull request #2163 from CruGlobal/renovate/lock-file-maintenance
levieggertcru Jun 10, 2024
732c8c7
apply user tool settings when tool is opened from favorites
rachaelblue Jun 11, 2024
d41ce0c
only apply tool settings if user initiated tool open from favorites s…
rachaelblue Jun 12, 2024
678284f
apply tool settings if user came from favorites through tool details
rachaelblue Jun 12, 2024
af4174c
Update dependency ruby to v3.3.3
renovate[bot] Jun 12, 2024
fddcaa8
remove unused method
rachaelblue Jun 12, 2024
77fa76e
add dashboard tab observer to app flow
rachaelblue Jun 13, 2024
804202c
also persist selected language id
rachaelblue Jun 14, 2024
bfb71f8
Lock file maintenance
renovate[bot] Jun 17, 2024
a4f19a4
Update dependency fastlane to v2.221.0
renovate[bot] Jun 18, 2024
3d8aedb
Merge pull request #2168 from CruGlobal/renovate/fastlane-2.x-lockfile
levieggertcru Jun 18, 2024
356787a
Update dependency fastlane to v2.221.1
renovate[bot] Jun 20, 2024
547157b
Merge pull request #2170 from CruGlobal/renovate/fastlane-2.x-lockfile
levieggertcru Jun 21, 2024
2a966e7
[skip ci] Adding latest localization files from OneSky
Jun 21, 2024
57c8467
Lock file maintenance
renovate[bot] Jun 24, 2024
4b34336
Merge pull request #2166 from CruGlobal/latest-onesky-translations
levieggertcru Jun 25, 2024
3c9373e
Merge pull request #2172 from CruGlobal/renovate/lock-file-maintenance
levieggertcru Jun 25, 2024
0f9d167
observe and persist selected language changes from the language toggle
rachaelblue Jun 25, 2024
931b9fd
Merge branch 'develop' into feature/app-languages-feature-release-2.0
levieggertcru Jun 25, 2024
de70b3d
rename shouldPersistToolSettings bool
rachaelblue Jun 25, 2024
e8d3d63
remove extra check that tool is favorited
rachaelblue Jun 25, 2024
31d7217
return unwrapped toolSettingsObserver
rachaelblue Jun 25, 2024
e2d0b88
fix naming scheme
rachaelblue Jun 25, 2024
993732d
clean up shouldPersistToolSettings conditional
rachaelblue Jun 25, 2024
9c16376
clean up
rachaelblue Jun 25, 2024
9bdbae6
make separate feature for persisting user tool language settings
rachaelblue Jun 26, 2024
347ffce
add default false value to shouldPersistToolSettings
rachaelblue Jun 27, 2024
b99ebbb
rename navigateToTool method to match new feature better
rachaelblue Jun 27, 2024
76fd881
Merge pull request #2164 from CruGlobal/GT-2313-Persist-Language-Choi…
rachaelblue Jun 27, 2024
8828fe9
Merge pull request #2092 from CruGlobal/feature/app-languages-feature…
levieggertcru Jun 27, 2024
660501e
Add amharic as app language
levieggertcru Jun 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.2
3.3.3
34 changes: 17 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GEM
base64
nkf
rexml
activesupport (7.1.3.3)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand All @@ -15,25 +15,25 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.937.0)
aws-sdk-core (3.196.1)
aws-partitions (1.947.0)
aws-sdk-core (3.198.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.82.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sdk-kms (1.86.0)
aws-sdk-core (~> 3, >= 3.198.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.151.0)
aws-sdk-core (~> 3, >= 3.194.0)
aws-sdk-s3 (1.153.0)
aws-sdk-core (~> 3, >= 3.198.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
Expand Down Expand Up @@ -83,7 +83,7 @@ GEM
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.3.1)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
declarative (0.0.20)
digest-crc (0.6.5)
Expand Down Expand Up @@ -125,7 +125,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.3.1)
fastlane (2.220.0)
fastlane (2.221.1)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -219,14 +219,14 @@ GEM
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.2)
jwt (2.8.1)
jwt (2.8.2)
base64
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0507)
mini_magick (4.12.0)
mime-types-data (3.2024.0604)
mini_magick (4.13.1)
mini_mime (1.1.5)
minitest (5.23.1)
minitest (5.24.0)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.4.1)
Expand All @@ -253,8 +253,8 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
retriable (3.1.2)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.2.9)
strscan
rouge (2.0.7)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
Expand Down
254 changes: 208 additions & 46 deletions godtools.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion godtools.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "21bf5557cd80854fb30416658e2f4affd5f9a1aedfae78f9a812d457ecc91fbe",
"originHash" : "a3d2041bcb8f3bbbaa3e44eda084568588879e2d51501ad6396f9c0eddb6d4d9",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,6 @@ class AppDataLayerDependencies {
return sharedInfoPlist
}

func getLanguageSettingsRepository() -> LanguageSettingsRepository {
return LanguageSettingsRepository(
cache: LanguageSettingsCache()
)
}

func getLanguagesRepository() -> LanguagesRepository {

let api = MobileContentLanguagesApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,44 @@ class GetLanguageSettingsInterfaceStringsRepository: GetLanguageSettingsInterfac

let localeId: String = translateInAppLanguage

let interfaceStrings = LanguageSettingsInterfaceStringsDomainModel(
navTitle: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsNavTitle.key, fileType: .strings),
appInterfaceLanguageTitle: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsAppInterfaceTitle.key, fileType: .strings),
numberOfAppLanguagesAvailable: getNumberOfAppLanguagesAvailableString(translateInAppLanguage: translateInAppLanguage),
setAppLanguageMessage: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsAppInterfaceMessage.key, fileType: .strings),
chooseAppLanguageButtonTitle: translatedLanguageNameRepository.getLanguageName(language: translateInAppLanguage, translatedInLanguage: translateInAppLanguage),
toolLanguagesAvailableOfflineTitle: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsToolLanguagesAvailableOfflineTitle.key, fileType: .strings),
downloadToolsForOfflineMessage: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsToolLanguagesAvailableOfflineMessage.key, fileType: .strings),
editDownloadedLanguagesButtonTitle: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsToolLanguagesAvailableOfflineEditDownloadedLanguagesButtonTitle.key, fileType: .strings)
)

return Just(interfaceStrings)
return getNumberOfAppLanguagesAvailableStringPublisher(translateInAppLanguage: translateInAppLanguage)
.map { (numberOfAppLanguagesInterfaceString: String) in

let interfaceStrings = LanguageSettingsInterfaceStringsDomainModel(
navTitle: self.localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsNavTitle.key, fileType: .strings),
appInterfaceLanguageTitle: self.localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsAppInterfaceTitle.key, fileType: .strings),
numberOfAppLanguagesAvailable: numberOfAppLanguagesInterfaceString,
setAppLanguageMessage: self.localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsAppInterfaceMessage.key, fileType: .strings),
chooseAppLanguageButtonTitle: self.translatedLanguageNameRepository.getLanguageName(language: translateInAppLanguage, translatedInLanguage: translateInAppLanguage),
toolLanguagesAvailableOfflineTitle: self.localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsToolLanguagesAvailableOfflineTitle.key, fileType: .strings),
downloadToolsForOfflineMessage: self.localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsToolLanguagesAvailableOfflineMessage.key, fileType: .strings),
editDownloadedLanguagesButtonTitle: self.localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: LocalizableStringKeys.languageSettingsToolLanguagesAvailableOfflineEditDownloadedLanguagesButtonTitle.key, fileType: .strings)
)

return interfaceStrings
}
.eraseToAnyPublisher()
}

private func getNumberOfAppLanguagesAvailableString(translateInAppLanguage: AppLanguageDomainModel) -> String {

let numberOfAppLanguages: Int = appLanguagesRepository.getNumberOfCachedLanguages()
private func getNumberOfAppLanguagesAvailableStringPublisher(translateInAppLanguage: AppLanguageDomainModel) -> AnyPublisher<String, Never> {

let localizedNumberOfLanguagesAvailable = localizationServices.stringForLocaleElseSystemElseEnglish(
localeIdentifier: translateInAppLanguage,
key: LocalizableStringDictKeys.languageSettingsAppLanguageNumberAvailable.key,
fileType: .stringsdict
)

let stringLocaleFormat = String(format: localizedNumberOfLanguagesAvailable, locale: Locale(identifier: translateInAppLanguage), numberOfAppLanguages)

return stringLocaleFormat
return appLanguagesRepository.observeNumberOfAppLanguagesPublisher()
.map { (numberOfAppLanguages: Int) in

let localizedNumberOfLanguagesAvailable = self.localizationServices.stringForLocaleElseSystemElseEnglish(
localeIdentifier: translateInAppLanguage,
key: LocalizableStringDictKeys.languageSettingsAppLanguageNumberAvailable.key,
fileType: .stringsdict
)

let stringLocaleFormat = String(
format: localizedNumberOfLanguagesAvailable,
locale: Locale(identifier: translateInAppLanguage),
numberOfAppLanguages
)

return stringLocaleFormat
}
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// AppLanguageCodable.swift
// godtools
//
// Created by Levi Eggert on 5/7/24.
// Copyright © 2024 Cru. All rights reserved.
//

import Foundation

struct AppLanguageCodable: Codable {

private static let languageDirectionLeftToRight: String = "ltr"
private static let languageDirectionRightToLeft: String = "rtl"

let languageCode: String
let languageDirectionValue: String
let languageScriptCode: String?

enum RootKeys: String, CodingKey {
case languageCode = "language_code"
case languageDirection = "language_direction"
case languageScriptCode = "language_script_code"
}

init(languageCode: String, languageDirection: AppLanguageDataModel.Direction, languageScriptCode: String?) {

self.languageCode = languageCode
self.languageDirectionValue = languageDirection == .rightToLeft ? AppLanguageCodable.languageDirectionRightToLeft : AppLanguageCodable.languageDirectionLeftToRight
self.languageScriptCode = languageScriptCode
}

init(from decoder: Decoder) throws {

let container = try decoder.container(keyedBy: RootKeys.self)

languageCode = try container.decode(String.self, forKey: .languageCode)
languageDirectionValue = try container.decode(String.self, forKey: .languageDirection)
languageScriptCode = try container.decodeIfPresent(String.self, forKey: .languageScriptCode)
}
}

extension AppLanguageCodable: AppLanguageDataModelInterface {

var languageDirection: AppLanguageDataModel.Direction {
return languageDirectionValue == AppLanguageCodable.languageDirectionRightToLeft ? .rightToLeft : .leftToRight
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// AppLanguagesApi.swift
// godtools
//
// Created by Levi Eggert on 5/7/24.
// Copyright © 2024 Cru. All rights reserved.
//

import Foundation
import Combine

class AppLanguagesApi {

init() {

}

func getAppLanguagesPublisher() -> AnyPublisher<[AppLanguageCodable], Error> {

let allAppLanguages: [AppLanguageCodable] = [
AppLanguageCodable(languageCode: "am", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "ar", languageDirection: .rightToLeft, languageScriptCode: nil),
AppLanguageCodable(languageCode: "en", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "es", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "pt", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "fr", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "id", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "zh", languageDirection: .leftToRight, languageScriptCode: "Hans"),
AppLanguageCodable(languageCode: "zh", languageDirection: .leftToRight, languageScriptCode: "Hant"),
AppLanguageCodable(languageCode: "hi", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "ru", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "vi", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "lv", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "bn", languageDirection: .leftToRight, languageScriptCode: nil),
AppLanguageCodable(languageCode: "ur", languageDirection: .rightToLeft, languageScriptCode: nil)
]

return Just(allAppLanguages).setFailureType(to: Error.self)
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,24 @@

import Foundation

struct AppLanguageDataModel {
struct AppLanguageDataModel: AppLanguageDataModelInterface {

let languageCode: String
let languageDirection: AppLanguageDataModel.Direction
let languageScriptCode: String?

var languageId: BCP47LanguageIdentifier {
init(languageCode: String, languageDirection: AppLanguageDataModel.Direction, languageScriptCode: String?) {

if let languageScriptCode = languageScriptCode, !languageScriptCode.isEmpty {
return languageCode + "-" + languageScriptCode
}
self.languageCode = languageCode
self.languageDirection = languageDirection
self.languageScriptCode = languageScriptCode
}

init(dataModel: AppLanguageDataModelInterface) {

return languageCode
self.languageCode = dataModel.languageCode
self.languageDirection = dataModel.languageDirection
self.languageScriptCode = dataModel.languageScriptCode
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// AppLanguageDataModelInterface.swift
// godtools
//
// Created by Levi Eggert on 5/7/24.
// Copyright © 2024 Cru. All rights reserved.
//

import Foundation

protocol AppLanguageDataModelInterface {

var languageCode: String { get }
var languageDirection: AppLanguageDataModel.Direction { get }
var languageScriptCode: String? { get }
}

extension AppLanguageDataModelInterface {

var languageId: BCP47LanguageIdentifier {

if let languageScriptCode = languageScriptCode, !languageScriptCode.isEmpty {
return languageCode + "-" + languageScriptCode
}

return languageCode
}
}
Loading
Loading