Translate rendering settings

This commit is contained in:
Victor Shcherb 2012-06-16 18:53:58 +02:00
parent 4e9088af31
commit 7b3191b209
2 changed files with 37 additions and 2 deletions

View file

@ -9,6 +9,14 @@
1. All your modified/created strings are in the top of the file (to make easier find what's translated). 1. 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 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_attr_noPolygons_description">Make all areal land features on map transparent</string>
<string name="rendering_attr_noPolygons_name">No polygons</string>
<string name="rendering_attr_appMode_name">Rendering mode</string>
<string name="rendering_attr_appMode_description">Map optimization for respective User Profile</string>
<string name="rendering_attr_contourLines_description">Select minimum zoom level to display in map if available. Separate SRTM-file may be needed.</string>
<string name="rendering_attr_contourLines_name">Show contour lines</string>
<string name="rendering_attr_hmRendered_description">Increase amount of map detail shown</string>
<string name="rendering_attr_hmRendered_name">Show more map detail</string>
<string name="local_index_routing_data">Routing data</string> <string name="local_index_routing_data">Routing data</string>
<string name="navigate_point_format">Format :</string> <string name="navigate_point_format">Format :</string>
<string name="poi_search_desc">POI (Point of interest) search</string> <string name="poi_search_desc">POI (Point of interest) search</string>

View file

@ -1,6 +1,7 @@
package net.osmand.plus.activities; package net.osmand.plus.activities;
import java.io.File; import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -110,6 +111,32 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
seekBarPreferences.put(b.getId(), b); seekBarPreferences.put(b.getId(), b);
} }
public String getStringPropertyName(String propertyName, String defValue) {
try {
Field f = R.string.class.getField("rendering_attr_"+propertyName+"_name");
if(f != null) {
Integer in = (Integer) f.get(null);
return getString(in);
}
} catch (Exception e) {
e.printStackTrace();
}
return defValue;
}
public String getStringPropertyDescription(String propertyName, String defValue) {
try {
Field f = R.string.class.getField("rendering_attr_"+propertyName+"_description");
if(f != null) {
Integer in = (Integer) f.get(null);
return getString(in);
}
} catch (Exception e) {
e.printStackTrace();
}
return defValue;
}
public SeekBarPreference createSeekBarPreference(OsmandPreference<Integer> b, int title, int summary, int dialogTextId, public SeekBarPreference createSeekBarPreference(OsmandPreference<Integer> b, int title, int summary, int dialogTextId,
int defValue, int maxValue){ int defValue, int maxValue){
SeekBarPreference p = new SeekBarPreference(this, dialogTextId, defValue, maxValue); SeekBarPreference p = new SeekBarPreference(this, dialogTextId, defValue, maxValue);
@ -373,8 +400,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
ListPreference lp = new ListPreference(this); ListPreference lp = new ListPreference(this);
lp.setOnPreferenceChangeListener(this); lp.setOnPreferenceChangeListener(this);
lp.setKey(custom.getId()); lp.setKey(custom.getId());
lp.setTitle(p.getName()); lp.setTitle(getStringPropertyName(custom.getId(), p.getName()));
lp.setSummary(p.getDescription()); lp.setSummary(getStringPropertyDescription(p.getAttrName(), p.getDescription()));
cat.addPreference(lp); cat.addPreference(lp);
LinkedHashMap<String, Object> vals = new LinkedHashMap<String, Object>(); LinkedHashMap<String, Object> vals = new LinkedHashMap<String, Object>();