Translation for possible values

This commit is contained in:
Zahnstocher 2014-08-09 12:56:26 +02:00
parent c289db6cce
commit dcfb4f9089
4 changed files with 33 additions and 3 deletions

View file

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rendering_value_browse_map_name">Karte ansehen</string>
<string name="rendering_value_car_name">Auto</string>
<string name="rendering_value_bicycle_name">Fahrrad</string>
<string name="rendering_value_pedestrian_name">Fußgänger</string>
<string name="announce_nearby_favorites">Ansage von Favoriten in den Nähe</string>
<string name="rendering_attr_coloredBuildings_name">Gefärbte Gebäude</string>
<string name="continue_navigation">Navigation fortsetzen</string>

View file

@ -9,6 +9,10 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="rendering_value_browse_map_name">Browse map</string>
<string name="rendering_value_car_name">Car</string>
<string name="rendering_value_bicycle_name">Bicycle</string>
<string name="rendering_value_pedestrian_name">Pedestrian</string>
<string name="rendering_attr_coloredBuildings_name">Colored buildings</string>
<string name="osmo_invite">Invite...</string>
<string name="osmo_leave_confirmation_msg">Do you want to leave group %1$s?</string>

View file

@ -152,6 +152,20 @@ public abstract class SettingsBaseActivity extends SherlockPreferenceActivity im
}
return defValue;
}
public static String getStringPropertyValue(Context ctx, String propertyValue) {
try {
propertyValue = propertyValue.replaceAll("\\s+","_");
Field f = R.string.class.getField("rendering_value_" + propertyValue + "_name");
if (f != null) {
Integer in = (Integer) f.get(null);
return ctx.getString(in);
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
return propertyValue;
}
public SeekBarPreference createSeekBarPreference(OsmandPreference<Integer> b, int title, int summary, int dialogTextId, int defValue,
int maxValue) {

View file

@ -207,9 +207,17 @@ public class AppearanceWidgetsFactory {
public void run() {
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
//test old descr as title
b.setTitle(propertyDescr);
int i = Arrays.asList(p.getPossibleValues()).indexOf(pref.get());
b.setSingleChoiceItems(p.getPossibleValues(), i, new DialogInterface.OnClickListener() {
b.setTitle(propertyDescr);
int i = Arrays.asList(p.getPossibleValues()).indexOf(pref.get());
String[] possibleValuesString = new String[p.getPossibleValues().length];
for (int j = 0; j < p.getPossibleValues().length; j++) {
possibleValuesString[j] = SettingsActivity.getStringPropertyValue(view.getContext(), p.getPossibleValues()[j]);
}
b.setSingleChoiceItems(possibleValuesString, i, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
pref.set(p.getPossibleValues()[which]);