Updated translations for wikipedia and srtm files

This commit is contained in:
Denis 2014-07-11 20:57:23 +04:00
parent 80c435861e
commit 30d25a4387
2 changed files with 23 additions and 14 deletions

View file

@ -201,6 +201,9 @@ public class DownloadActivityType {
return getBasename(indexItem);
}
final String bn = getBasename(indexItem);
if (bn.endsWith(FileNameTranslationHelper.WIKI_NAME)){
return FileNameTranslationHelper.getWikiName(ctx,bn);
}
final String lc = bn.toLowerCase();
String std = FileNameTranslationHelper.getStandardMapName(ctx, lc);
if (std != null) {

View file

@ -13,21 +13,12 @@ import java.lang.reflect.Field;
*/
public class FileNameTranslationHelper {
public static final String WIKI_NAME = "_wiki";
public static String getFileName(Context ctx, OsmandRegions regions, String fileName) {
String basename = getBasename(fileName);
if (basename.endsWith("_wiki")) { //wiki files
String cutted = basename.substring(0, basename.indexOf("_wiki"));
String wikiName = getStandardLangName(ctx, cutted);
if (wikiName == null){
wikiName = cutted;
}
String wikiWord = ctx.getString(R.string.amenity_type_osmwiki);
int index = wikiWord.indexOf("(");
if (index >= 0) {
//removing word in "()" from recourse file
return wikiWord.substring(0, index) + wikiName;
}
return ctx.getString(R.string.amenity_type_osmwiki) + " " + wikiName;
if (basename.endsWith(WIKI_NAME)) { //wiki files
return getWikiName(ctx,basename);
} else if (fileName.endsWith("tts")) { //tts files
return getVoiceName(ctx, fileName);
} else if (fileName.length() == 2) { //voice recorded files
@ -56,6 +47,21 @@ public class FileNameTranslationHelper {
return null;
}
public static String getWikiName(Context ctx, String basename){
String cutted = basename.substring(0, basename.indexOf("_wiki"));
String wikiName = getStandardLangName(ctx, cutted);
if (wikiName == null){
wikiName = cutted;
}
String wikiWord = ctx.getString(R.string.amenity_type_osmwiki);
int index = wikiWord.indexOf("(");
if (index >= 0) {
//removing word in "()" from recourse file
return wikiWord.substring(0, index) + wikiName;
}
return ctx.getString(R.string.amenity_type_osmwiki) + " " + wikiName;
}
public static String getVoiceName(Context ctx, String basename) {
try {
String nm = basename.replace('-', '_').replace(' ', '_');
@ -85,7 +91,7 @@ public class FileNameTranslationHelper {
if (ls >= 0) {
return fileName.substring(0, ls);
} else {
ls = fileName.lastIndexOf(".");
ls = fileName.indexOf(".");
if (ls >= 0) {
return fileName.substring(0, ls);
}