try replacing en with default language

This commit is contained in:
sonora 2015-06-13 18:26:07 +02:00
parent f1f1392933
commit c10aabfd26

View file

@ -393,7 +393,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
// "" is also returned if no name can be found at all // "" is also returned if no name can be found at all
} }
if(Algorithms.isEmpty(lng)) { if(Algorithms.isEmpty(lng)) {
lng = "EN"; lng = "Default language";
} }
final String langSelected = lng; final String langSelected = lng;
@ -405,6 +405,10 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
@Override @Override
public void onClick(View v) { public void onClick(View v) {
String article = "http://"+langSelected.toLowerCase()+".wikipedia.org/wiki/" + title.replace(' ', '_'); String article = "http://"+langSelected.toLowerCase()+".wikipedia.org/wiki/" + title.replace(' ', '_');
// Use EN for the URL, unless we find a better way to determine what the articles default language is
if(langSelected.equals("Default language")) {
article = "http://en.wikipedia.org/wiki/" + title.replace(' ', '_');
}
Intent i = new Intent(Intent.ACTION_VIEW); Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(article)); i.setData(Uri.parse(article));
ctx.startActivity(i); ctx.startActivity(i);
@ -465,7 +469,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
protected static void showPopupLangMenu(final Context ctx, Toolbar tb, protected static void showPopupLangMenu(final Context ctx, Toolbar tb,
final OsmandApplication app, final Amenity a, final Dialog dialog) { final OsmandApplication app, final Amenity a, final Dialog dialog) {
final PopupMenu optionsMenu = new PopupMenu(ctx, tb, Gravity.RIGHT); final PopupMenu optionsMenu = new PopupMenu(ctx, tb, Gravity.RIGHT);
List<String> names = a.getNames("xx"); List<String> names = a.getNames("Default Language");
for (final String n : names) { for (final String n : names) {
String vn = FileNameTranslationHelper.getVoiceName(ctx, n); String vn = FileNameTranslationHelper.getVoiceName(ctx, n);
MenuItem item = optionsMenu.getMenu().add(vn); MenuItem item = optionsMenu.getMenu().add(vn);