Skip to content

Commit

Permalink
Added VersionInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
mtotschnig committed Aug 24, 2023
1 parent de054a7 commit 61dfc93
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ChangeLog/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

application {
Expand Down
30 changes: 30 additions & 0 deletions ChangeLog/src/main/java/org/totschnig/changelog/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import net.sf.saxon.s9api.XsltCompiler
import net.sf.saxon.s9api.XsltExecutable
import net.sf.saxon.s9api.XsltTransformer
import java.io.File
import java.lang.UnsupportedOperationException
import java.util.*
import javax.xml.transform.stream.StreamSource
import kotlin.system.exitProcess
Expand Down Expand Up @@ -46,6 +47,34 @@ class Main {
}
}

private var displayNameForCountry: ExtensionFunction = object : ExtensionFunction {
override fun getName() =
QName("http://myexpenses.mobi/", "displayNameForCountry")

override fun getResultType() = SequenceType.makeSequenceType(
ItemType.STRING, OccurrenceIndicator.ONE
)

override fun getArgumentTypes() = arrayOf(
SequenceType.makeSequenceType(
ItemType.STRING, OccurrenceIndicator.ONE
),
SequenceType.makeSequenceType(
ItemType.STRING, OccurrenceIndicator.ONE
)
)

@Throws(SaxonApiException::class)
override fun call(arguments: Array<XdmValue>): XdmValue {
val targetCountry = (arguments[0].itemAt(0) as XdmAtomicValue).stringValue
val displayLanguage = (arguments[1].itemAt(0) as XdmAtomicValue).stringValue
return XdmAtomicValue(when(targetCountry) {
"de" -> Locale.GERMANY
else -> throw UnsupportedOperationException()
}.getDisplayCountry(Locale(displayLanguage)))
}
}

private var fileExists: ExtensionFunction = object : ExtensionFunction {
override fun getName() = QName("http://myexpenses.mobi/", "fileExists")

Expand Down Expand Up @@ -132,6 +161,7 @@ class Main {
processor.registerExtensionFunction(displayNameForLanguage)
processor.registerExtensionFunction(fileExists)
processor.registerExtensionFunction(displayNameForScript)
processor.registerExtensionFunction(displayNameForCountry)
val out: Serializer = outFile?.let { processor.newSerializer(File(it)) } ?: processor.newSerializer(System.out)
val compiler: XsltCompiler = processor.newXsltCompiler()
val stylesheet: XsltExecutable =
Expand Down
8 changes: 8 additions & 0 deletions doc/helpers.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,14 @@
<xsl:apply-templates mode="unescape"
select="document($strings)/resources/string[@name='ui_refinement']" />
</xsl:when>
<xsl:when test="$version = '3.6.3'">
<xsl:if test="$itemize">
<xsl-text>•&#032;</xsl-text>
</xsl:if>
<xsl:text>Multibanking&#032;(</xsl:text>
<xsl:value-of select="my:displayNameForCountry('de', $lang)" />
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ class VersionInfo(val code: Int, val name: String) : Parcelable {
"362" -> arrayOf(
"${t(R.string.menu_settings)}: ${t(R.string.ui_refinement)}"
)
"363" -> arrayOf(
"Multibanking (${Locale.GERMANY.displayCountry})"
)
else -> {
val resId = res.getIdentifier(
"whats_new_$nameCondensed",
Expand Down
2 changes: 1 addition & 1 deletion myExpenses/src/main/res/xml/preference_headers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<Preference
my:isPreferenceVisible="@bool/is26"
android:key="@string/pref_banking_fints_key"
android:title="Banking" />
android:title="Multibanking" />
</PreferenceCategory>

<Preference
Expand Down

0 comments on commit 61dfc93

Please sign in to comment.