Skip to content

Commit

Permalink
update translations and tag editor suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Helium314 committed Jul 15, 2023
1 parent 31b43dc commit 329704d
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 51 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/src/main/assets/tag_editor/valueSuggestionsByKey.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ class ChangelogFragment : TwoPaneDetailFragment(R.layout.fragment_changelog), Ha
binding.changelogList.addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL))

viewLifecycleScope.launch {
val changelog = readChangelog(resources)
val r = "(?:\\d+(?:\\.\\d*)?|\\.\\d+)".toRegex()
// merge changelogs and sort by version
val changelog = (readScChangelog(resources) + readSceeChangelog(resources)).sortedBy {
val version = r.find(it.title)?.value?.toDoubleOrNull() ?: 0.0
val modifier1 = if (it.title.startsWith("SCEE")) -0.001 else 0.0
val modifier2 = if (it.title.contains("beta")) 0.0001 else 0.0
val modifier3 = if (it.title.contains("alpha")) 0.0002 else 0.0
0.0 - version + modifier1 + modifier2 + modifier3
}
binding.changelogList.adapter = ChangelogAdapter(changelog)
}
}
Expand All @@ -59,11 +67,12 @@ class WhatsNewDialog(context: Context, sinceVersion: String) : AlertDialog(conte
setButton(DialogInterface.BUTTON_POSITIVE, context.resources.getText(android.R.string.ok), null, null)

scope.launch {
val fullChangelog = readChangelog(context.resources)
var currentVersionIndex = fullChangelog.indexOfFirst { it.title == sinceVersion }
val changelogScee = readSceeChangelog(context.resources)
val changelogSc = readScChangelog(context.resources)
var currentVersionIndex = changelogScee.indexOfFirst { it.title == "SCEE $sinceVersion" }
// if version not found, just show the last one
if (currentVersionIndex == -1) currentVersionIndex = 2
val changelog = fullChangelog.subList(0, currentVersionIndex)
if (currentVersionIndex == -1) currentVersionIndex = 1
val changelog = changelogScee.subList(0, currentVersionIndex) + changelogSc.first()

binding.changelogList.adapter = ChangelogAdapter(changelog)
}
Expand All @@ -90,17 +99,12 @@ class ChangelogAdapter(changelog: List<Release>) : ListAdapter<Release>(changelo

data class Release(val title: String, val description: String)

private suspend fun readChangelog(resources: Resources): List<Release> = withContext(Dispatchers.IO) {
val upstreamChangelog = resources.getYamlStringMap(R.raw.changelog).map { Release("StreetComplete " + it.key, addedLinks(it.value)) }
val eeChangelog = resources.getYamlStringMap(R.raw.changelog_ee).map { Release("SCEE " + it.key, addedLinksEE(it.value)) }
val r = "(?:\\d+(?:\\.\\d*)?|\\.\\d+)".toRegex()
(upstreamChangelog + eeChangelog).sortedBy {
val version = r.find(it.title)?.value?.toDoubleOrNull() ?: 0.0
val modifier1 = if (it.title.startsWith("SCEE")) -0.001 else 0.0
val modifier2 = if (it.title.contains("beta")) 0.0001 else 0.0
val modifier3 = if (it.title.contains("alpha")) 0.0002 else 0.0
0.0 - version + modifier1 + modifier2 + modifier3
}
private suspend fun readSceeChangelog(resources: Resources): List<Release> = withContext(Dispatchers.IO) {
resources.getYamlStringMap(R.raw.changelog_ee).map { Release("SCEE " + it.key, addedLinksEE(it.value)) }
}

private suspend fun readScChangelog(resources: Resources): List<Release> = withContext(Dispatchers.IO) {
resources.getYamlStringMap(R.raw.changelog).map { Release("StreetComplete " + it.key, addedLinks(it.value)) }
}

private fun addedLinks(description: String): String {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/raw/changelog_ee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ v53.32: |
<li>Allow disabling achievement messages</li>
<li>Allow overriding whether some quests are hidden by overlays (#434)</li>
<li>Optionally add <i>switch presets</i> button to (non-grid) main menu (#433)</li>
<li>Update translations, thanks to m-martin, mike140, gallegonovato and un-logic</li>
</ul>
v53.31: |
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/res/values-es/strings_ee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
<string name="quest_surface_value_stepping_stones">Piedras pasaderas</string>
<string name="quest_buildingType_presbytery">Casa parroquial</string>
<string name="quest_buildingType_barn">Granero</string>
<string name="quest_buildingType_stable">Establo</string>
<string name="quest_buildingType_stable">Estable</string>
<string name="quest_buildingType_sty">Pocilga</string>
<string name="quest_buildingType_riding_hall">Sala de equitación</string>
<string name="quest_lanes_answer_noLanes_known_count">Sin marcas, conteo de carriles obvio</string>
Expand Down Expand Up @@ -390,7 +390,7 @@
<string name="quest_settings_dot_labels_message">Establezca qué etiquetas deben usarse para la etiqueta, en el orden dado. Una cadena vacía nunca mostrará ninguna etiqueta, \"label\" mostrará la etiqueta de nombre predeterminada de StreetComplete usando el nombre, la marca, la referencia, la referencia local y el operador.</string>
<string name="quest_settings_what_to_edit">¿Qué configurar\?</string>
<string name="quest_poi_vending_title">POI: Máquina expendedora %s</string>
<string name="quest_fixme_title">FixMe: %1$s</string>
<string name="quest_fixme_title">Corrigeme: %1$s</string>
<string name="default_disabled_msg_poi_fixme">Esta \"tarea\" muestra FixMes como puntos rojos (con excepciones predeterminadas de \'sí\' y \'continuar\'). Haga clic en el punto para mostrar detalles y otras respuestas.</string>
<string name="quest_fixme_remove">Eliminar este fixme</string>
<string name="quest_railwayPlatformRef_abc">ABC</string>
Expand All @@ -399,4 +399,9 @@
<string name="quest_buildingColour_title">¿Qué color general tiene este edificio\?</string>
<string name="quest_buildingPartColour_title">¿Qué color general tiene esta parte del edificio\?</string>
<string name="restriction_overlay_only_for">Sólo para: %s</string>
<string name="pref_update_local_statistics">Actualizar las estadísticas al subir</string>
<string name="pref_update_local_statistics_summary">La desactivación acelera la carga y detiene los mensajes de logros</string>
<string name="pref_hide_overlay_quests">Ocultar las funciones específicas de la superposición</string>
<string name="pref_main_menu_switch_presets_title">Cambiar el botón preestablecido en el menú principal</string>
<string name="outside_downloaded_area_warning">Este lugar está fuera de la zona cargada. ¿Continuar\?</string>
</resources>
28 changes: 27 additions & 1 deletion app/src/main/res/values-fr/strings_ee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,30 @@
\nS\'il y a deux voies le long d\'une plate-forme, utilisez des valeurs séparées par des points-virgules, par exemple 2;3</string>
<string name="custom_overlay_filter_message">Cliquez sur le lien ci-dessous pour afficher des informations sur la syntaxe de sélection des éléments dans un navigateur. Notez que lors de la sélection d\'éléments par ancienneté, le réglage de l\'intervalle de ré-enquête peut influencer le résultat.
\nLes cases à cocher remplacent la partie \"nœuds, chemins avec\".</string>
</resources>
<string name="pref_update_local_statistics">Mettre à jour les statistiques lors de l\'envoi</string>
<string name="pref_hide_overlay_quests">Masquer les quêtes spécifiques aux surcouches</string>
<string name="pref_main_menu_switch_presets_title">Changer le bouton de présélection dans le menu principal</string>
<string name="quest_is_pharmacy_dispensing_title">Cette pharmacie délivre-t-elle tous les types de médicaments prescrits \?</string>
<string name="quest_buildingPartColour_title">Quelle est la couleur dominante de cette partie du bâtiment \?</string>
<string name="quest_buildingColour_title">Quelle est la couleur dominante de ce bâtiment \?</string>
<string name="quest_roofColour_title">Quelle est la couleur dominante du toit de ce bâtiment \?</string>
<string name="quest_destination_add_more">Ajouter une autre destination</string>
<string name="quest_destination_all_lanes_button">Toutes
\nles voies</string>
<string name="quest_destination_title">Quelles sont les directions indiquées pour cette route \?</string>
<string name="restriction_overlay_other_restrictions">Autres restrictions sur ce chemin :</string>
<string name="create_relation_action_description">Vous avez créé une relation avec …</string>
<string name="outside_downloaded_area_warning">Ce lieu est situé en dehors de la zone téléchargée. Poursuivre \?</string>
<string name="restriction_overlay_only_for">Seulement pour : %s</string>
<string name="restriction_overlay_show_details">Afficher les détails de la relation</string>
<string name="restriction_overlay_relation_unsupported">Type de relation non supporté :
\n%s</string>
<string name="restriction_overlay_exceptions">Exceptions : %s</string>
<string name="restriction_overlay_remove_conditional_restrictions">Supprimer la condition</string>
<string name="restriction_overlay_sign_stop_all_way">Stop (toutes voies)</string>
<string name="restriction_overlay_title">Restrictions de circulation</string>
<string name="restriction_overlay_direction_text">S\'applique au sens de circulation :</string>
<string name="restriction_overlay_sign_give_way">Cédez-le-passage</string>
<string name="restriction_overlay_sign_stop">Stop</string>
<string name="pref_create_node_show_keyboard_title">Afficher automatiquement le clavier lors de l\'ajout d\'un nœud</string>
</resources>
Loading

0 comments on commit 329704d

Please sign in to comment.