-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from Infomaniak/is-email-language-default
Feature: Add specific Android and iOS code to set the default email language to match the phone's language
- Loading branch information
Showing
8 changed files
with
127 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ain/kotlin/com/infomaniak/multiplatform_swisstransfer/utils/EmailLanguageUtils.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Infomaniak SwissTransfer - Multiplatform | ||
* Copyright (C) 2024 Infomaniak Network SA | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.infomaniak.multiplatform_swisstransfer.utils | ||
|
||
import com.infomaniak.multiplatform_swisstransfer.common.models.EmailLanguage | ||
import java.util.Locale | ||
|
||
actual class EmailLanguageUtils actual constructor() { | ||
|
||
actual fun getEmailLanguageFromLocal(): EmailLanguage { | ||
return when (Locale.getDefault().language) { | ||
"fr" -> EmailLanguage.FRENCH | ||
"de" -> EmailLanguage.GERMAN | ||
"it" -> EmailLanguage.ITALIAN | ||
"es" -> EmailLanguage.SPANISH | ||
else -> EmailLanguage.ENGLISH | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...eMain/kotlin/com/infomaniak/multiplatform_swisstransfer/utils/EmailLanguageUtils.apple.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Infomaniak SwissTransfer - Multiplatform | ||
* Copyright (C) 2024 Infomaniak Network SA | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.infomaniak.multiplatform_swisstransfer.utils | ||
|
||
import com.infomaniak.multiplatform_swisstransfer.common.models.EmailLanguage | ||
import platform.Foundation.NSLocale | ||
import platform.Foundation.currentLocale | ||
import platform.Foundation.languageCode | ||
|
||
actual class EmailLanguageUtils actual constructor() { | ||
actual fun getEmailLanguageFromLocal(): EmailLanguage { | ||
val currentLocale = NSLocale.currentLocale | ||
return when (currentLocale.languageCode) { | ||
"fr" -> EmailLanguage.FRENCH | ||
"de" -> EmailLanguage.GERMAN | ||
"es" -> EmailLanguage.SPANISH | ||
"it" -> EmailLanguage.ITALIAN | ||
else -> EmailLanguage.ENGLISH | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/utils/EmailLanguageUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Infomaniak SwissTransfer - Multiplatform | ||
* Copyright (C) 2024 Infomaniak Network SA | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.infomaniak.multiplatform_swisstransfer.utils | ||
|
||
import com.infomaniak.multiplatform_swisstransfer.common.models.EmailLanguage | ||
|
||
expect class EmailLanguageUtils() { | ||
fun getEmailLanguageFromLocal(): EmailLanguage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters