-
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.
- Loading branch information
Showing
7 changed files
with
134 additions
and
40 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
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 |
---|---|---|
|
@@ -2,4 +2,38 @@ | |
<string name="shareEmailTo" translatable="false">[email protected]</string> | ||
<string name="shareSubject" translatable="false">[bug-report] OONI Probe %1$s</string> | ||
<string name="version" translatable="false">%1$s: %2$s</string> | ||
|
||
<plurals name="Common_Minutes" translatable="false"> | ||
<item quantity="one">@string/Common_Minutes_One</item> | ||
<item quantity="other">@string/Common_Minutes_Other</item> | ||
</plurals> | ||
<plurals name="Common_Hours" translatable="false"> | ||
<item quantity="one">@string/Common_Hour_One</item> | ||
<item quantity="other">@string/Common_Hour_Other</item> | ||
</plurals> | ||
|
||
<plurals name="Dashboard_RunTests_RunButton_Label" translatable="false"> | ||
<item quantity="one">@string/Dashboard_RunTests_RunButton_Label_One</item> | ||
<item quantity="other">@string/Dashboard_RunTests_RunButton_Label_Other</item> | ||
</plurals> | ||
|
||
<plurals name="Measurements_Count" translatable="false"> | ||
<item quantity="one">@string/Measurements_Count_One</item> | ||
<item quantity="other">@string/Measurements_Count_Other</item> | ||
</plurals> | ||
|
||
<string-array name="Common_Months" translatable="false"> | ||
<item>@string/Common_Months_January</item> | ||
<item>@string/Common_Months_February</item> | ||
<item>@string/Common_Months_March</item> | ||
<item>@string/Common_Months_April</item> | ||
<item>@string/Common_Months_May</item> | ||
<item>@string/Common_Months_June</item> | ||
<item>@string/Common_Months_July</item> | ||
<item>@string/Common_Months_August</item> | ||
<item>@string/Common_Months_September</item> | ||
<item>@string/Common_Months_October</item> | ||
<item>@string/Common_Months_November</item> | ||
<item>@string/Common_Months_December</item> | ||
</string-array> | ||
</resources> |
67 changes: 67 additions & 0 deletions
67
composeApp/src/commonMain/kotlin/org/ooni/probe/shared/ResourceExt.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,67 @@ | ||
package org.ooni.probe.shared | ||
|
||
import androidx.compose.runtime.Composable | ||
import ooniprobe.composeapp.generated.resources.Common_Hour_One | ||
import ooniprobe.composeapp.generated.resources.Common_Hour_Other | ||
import ooniprobe.composeapp.generated.resources.Common_Minutes_One | ||
import ooniprobe.composeapp.generated.resources.Common_Minutes_Other | ||
import ooniprobe.composeapp.generated.resources.Common_Months_April | ||
import ooniprobe.composeapp.generated.resources.Common_Months_August | ||
import ooniprobe.composeapp.generated.resources.Common_Months_December | ||
import ooniprobe.composeapp.generated.resources.Common_Months_February | ||
import ooniprobe.composeapp.generated.resources.Common_Months_January | ||
import ooniprobe.composeapp.generated.resources.Common_Months_July | ||
import ooniprobe.composeapp.generated.resources.Common_Months_June | ||
import ooniprobe.composeapp.generated.resources.Common_Months_March | ||
import ooniprobe.composeapp.generated.resources.Common_Months_May | ||
import ooniprobe.composeapp.generated.resources.Common_Months_November | ||
import ooniprobe.composeapp.generated.resources.Common_Months_October | ||
import ooniprobe.composeapp.generated.resources.Common_Months_September | ||
import ooniprobe.composeapp.generated.resources.Dashboard_RunTests_RunButton_Label_One | ||
import ooniprobe.composeapp.generated.resources.Dashboard_RunTests_RunButton_Label_Other | ||
import ooniprobe.composeapp.generated.resources.Measurements_Count_One | ||
import ooniprobe.composeapp.generated.resources.Measurements_Count_Other | ||
import ooniprobe.composeapp.generated.resources.Res | ||
import org.jetbrains.compose.resources.PluralStringResource | ||
import org.jetbrains.compose.resources.pluralStringResource | ||
import org.jetbrains.compose.resources.stringResource | ||
|
||
val stringMap = mapOf( | ||
"@string/Common_Minutes_One" to Res.string.Common_Minutes_One, | ||
"@string/Common_Minutes_Other" to Res.string.Common_Minutes_Other, | ||
"@string/Common_Hour_One" to Res.string.Common_Hour_One, | ||
"@string/Common_Hour_Other" to Res.string.Common_Hour_Other, | ||
"@string/Dashboard_RunTests_RunButton_Label_One" to Res.string.Dashboard_RunTests_RunButton_Label_One, | ||
"@string/Dashboard_RunTests_RunButton_Label_Other" to Res.string.Dashboard_RunTests_RunButton_Label_Other, | ||
"@string/Measurements_Count_One" to Res.string.Measurements_Count_One, | ||
"@string/Measurements_Count_Other" to Res.string.Measurements_Count_Other, | ||
) | ||
|
||
@Composable | ||
fun stringMonthArrayResource(): List<String> { | ||
return listOf( | ||
stringResource(Res.string.Common_Months_January), | ||
stringResource(Res.string.Common_Months_February), | ||
stringResource(Res.string.Common_Months_March), | ||
stringResource(Res.string.Common_Months_April), | ||
stringResource(Res.string.Common_Months_May), | ||
stringResource(Res.string.Common_Months_June), | ||
stringResource(Res.string.Common_Months_July), | ||
stringResource(Res.string.Common_Months_August), | ||
stringResource(Res.string.Common_Months_September), | ||
stringResource(Res.string.Common_Months_October), | ||
stringResource(Res.string.Common_Months_November), | ||
stringResource(Res.string.Common_Months_December), | ||
) | ||
} | ||
|
||
@Composable | ||
fun pluralStringResourceItem( | ||
resource: PluralStringResource, | ||
quantity: Int, | ||
vararg formatArgs: Any, | ||
): String { | ||
return stringMap[pluralStringResource(resource, quantity, formatArgs)]?.let { | ||
return stringResource(it, *formatArgs) | ||
} ?: "" | ||
} |
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
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