Skip to content

Commit

Permalink
Merge branch 'translate_imagery_config'
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpoole committed Dec 9, 2023
2 parents 0cf5bee + a6d6cb8 commit ebe62e7
Show file tree
Hide file tree
Showing 74 changed files with 30,460 additions and 57 deletions.
8 changes: 8 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ type = PO
minimum_perc = 5
lang_map = he: iw, ca_ES: ca-rES, cs: cs-rCZ, zh_TW: zh-rTW, zh_CN: zh-rCN, id: in, zh_HK: zh-rHK, pt_BR: pt-rBR, sv_SE: sv-rSE

[o:openstreetmap:p:id-editor:r:imagery]
file_filter = build/tmp/imagery/<lang>.yml
source_file = build/tmp/imagery/en.yml
source_lang = en
type = PO
minimum_perc = 1
lang_map = he: iw, ca_ES: ca-rES, cs: cs-rCZ, zh_TW: zh-rTW, zh_CN: zh-rCN, id: in, zh_HK: zh-rHK, pt_BR: pt-rBR, sv_SE: sv-rSE

[o:openstreetmap:p:vespucci:r:addresstagsxml]
file_filter = src/main/res/values-<lang>/addresstags.xml
source_file = src/main/res/values/addresstags.xml
Expand Down
32 changes: 26 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ buildscript {
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:3.0.1'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.1'
classpath 'com.malinskiy.marathon:marathon-gradle-plugin:0.8.4'
classpath 'org.apache.groovy:groovy-yaml:5.0.0-alpha-3'
}
}

Expand All @@ -34,6 +35,8 @@ plugins {
id "com.github.ben-manes.versions" version "0.39.0"
}
import de.undercouch.gradle.tasks.download.Download
import groovy.json.*
import groovy.yaml.*

// Project level build file starts here
apply plugin: 'eclipse'
Expand All @@ -55,18 +58,25 @@ allprojects {
}
}


ext {
private_assets = "$projectDir/../private_assets"
imagery_assets_dir = projectDir.getPath() + '/src/main/assets/imagery/'
help_assets_dir = projectDir.getPath() + '/src/main/assets/help'
}

markdownToHtml {
sourceDir = new File(projectDir.getPath() + '/documentation/docs/help')
inputEncoding ="utf8"
outputDir = new File(projectDir.getPath() + '/src/main/assets/help')
outputDir = new File(help_assets_dir)
outputEncoding = "utf8"
configuration.template = projectDir.getPath() + "/documentation/html_template.tpl"
}

task markdownToHtmlRtl(type: ch.poole.gradle.markdown.MarkdownToHtmlTask) {
sourceDir = new File(projectDir.getPath() + '/documentation/docs/help-rtl')
inputEncoding ="utf8"
outputDir = new File(projectDir.getPath() + '/src/main/assets/help')
outputDir = new File(help_assets_dir)
outputEncoding = "utf8"
configuration.template = projectDir.getPath() + "/documentation/html_template_rtl.tpl"
}
Expand Down Expand Up @@ -95,6 +105,19 @@ task updatePreset(dependsOn: ["downloadPresetFile", "downloadPresetIconsZipFile"
updatePreset.group = 'vespucci'
updatePreset.description = 'Update the default preset from http://simonpoole.github.io/beautified-JOSM-preset/'

task generateImageryTranslations () {
description "Convert yaml translation file to json"
mkdir(imagery_assets_dir)
doLast {
fileTree(dir: 'build/tmp/imagery/').each { yml ->
def data = new YamlSlurper().parse(yml)
def json = new JsonBuilder(data).toPrettyString()
def output = new File(imagery_assets_dir + yml.getName().replace('.yml','.json'))
output.write(json);
}
}
}

task updateImageryFromJosm(type: Download) {
acceptAnyCertificate true
src 'https://josm.openstreetmap.de/maps?format=geojson'
Expand Down Expand Up @@ -153,6 +176,7 @@ update3rdPartyDocs.description = 'Update markdown help files for 3rd party libra
}

task updateTranslations(type: Exec) {
finalizedBy generateImageryTranslations
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine 'cmd', '/c', 'tx.exe', 'pull', '-a'
} else {
Expand Down Expand Up @@ -214,10 +238,6 @@ sonarqube {
property "sonar.coverage.jacoco.xmlReportPaths","build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
}
}

ext {
private_assets = "$projectDir/../private_assets"
}

android {
namespace "de.blau.android"
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/tutorials/other/remove_bing_key.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BING imagery true
Bing imagery true
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void customImageryLocalPMTiles() {
assertTrue(TestUtils.textGone(device, main.getString(R.string.layer_add_custom_imagery), 2000));
assertTrue(TestUtils.findText(device, false, "protomaps 2023-01")); // layer dialog
try (TileLayerDatabase db = new TileLayerDatabase(ApplicationProvider.getApplicationContext())) {
TileLayerSource tls = TileLayerDatabase.getLayer(main, db.getReadableDatabase(), "PROTOMAPS20230118T074939Z");
TileLayerSource tls = TileLayerDatabase.getLayer(main, db.getReadableDatabase(), "protomaps20230118T074939Z");
assertNotNull(tls);
assertEquals(TileLayerSource.TYPE_PMT_3, tls.getType());
assertEquals(TileLayerSource.TileType.MVT, tls.getTileType());
Expand Down Expand Up @@ -231,7 +231,7 @@ public void customImageryRemotePMTiles() {
assertTrue(TestUtils.textGone(device, main.getString(R.string.layer_add_custom_imagery), 2000));
assertTrue(TestUtils.findText(device, false, "protomaps 2023-01")); // layer dialog
try (TileLayerDatabase db = new TileLayerDatabase(ApplicationProvider.getApplicationContext())) {
TileLayerSource tls = TileLayerDatabase.getLayer(main, db.getReadableDatabase(), "PROTOMAPS20230118T074939Z");
TileLayerSource tls = TileLayerDatabase.getLayer(main, db.getReadableDatabase(), "protomaps20230118T074939Z");
assertNotNull(tls);
assertEquals(TileLayerSource.TYPE_PMT_3, tls.getType());
assertEquals(TileLayerSource.TileType.MVT, tls.getTileType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void mvtMBTilesTest() {
TestUtils.selectFile(device, main, "mbtiles", "osm-liberty.json", true);
assertTrue(TestUtils.clickText(device, false, main.getString(R.string.Done), true));
// check that we actually loaded something
de.blau.android.layer.mvt.MapOverlay layer = (MapOverlay) map.getLayer(LayerType.IMAGERY, "TILEMAKERTOOPENMAPTILESSCHEMA");
de.blau.android.layer.mvt.MapOverlay layer = (MapOverlay) map.getLayer(LayerType.IMAGERY, "TilemakertoOpenMapTilesschema");
assertNotNull(layer);
Style style = layer.getStyle();
assertNotNull(style);
Expand Down
Loading

0 comments on commit ebe62e7

Please sign in to comment.