mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	localeFix
This commit is contained in:
		
							parent
							
								
									bdda18223e
								
							
						
					
					
						commit
						7f537f2ccd
					
				
					 3 changed files with 16 additions and 5 deletions
				
			
		|  | @ -1367,8 +1367,10 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private String chooseDescription(Media media) { |     private String chooseDescription(Media media) { | ||||||
|  |         String fullCode = Locale.getDefault().getLanguage(); | ||||||
|  |         String mainCode = fullCode.contains(",") ? fullCode.substring(0, fullCode.indexOf(',')).trim() : fullCode; | ||||||
|         final Map<String, String> descriptions = media.getDescriptions(); |         final Map<String, String> descriptions = media.getDescriptions(); | ||||||
|         final String multilingualDesc = descriptions.get(Locale.getDefault().getLanguage()); |         final String multilingualDesc = descriptions.get(mainCode); | ||||||
|         if (multilingualDesc != null) { |         if (multilingualDesc != null) { | ||||||
|             return multilingualDesc; |             return multilingualDesc; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -640,13 +640,17 @@ public class OkHttpJsonApiClient { | ||||||
|             } |             } | ||||||
|         }).doOnError(Timber::e)); |         }).doOnError(Timber::e)); | ||||||
|     } |     } | ||||||
|  |     String fullCode = Locale.getDefault().getLanguage(); | ||||||
|  |     String mainCode = fullCode.contains(",") ? fullCode.substring(0, fullCode.indexOf(',')).trim() : fullCode; | ||||||
| 
 | 
 | ||||||
|     @NotNull |     @NotNull | ||||||
|     private Request sparqlQuery(String qid, int startPosition, int limit, String fileName) |     private Request sparqlQuery(String qid, int startPosition, int limit, String fileName) | ||||||
|         throws IOException { |         throws IOException { | ||||||
|  |         String fullCode = Locale.getDefault().getLanguage(); | ||||||
|  |         String mainCode = fullCode.contains(",") ? fullCode.substring(0, fullCode.indexOf(',')).trim() : fullCode; | ||||||
|         String query = FileUtils.readFromResource(fileName) |         String query = FileUtils.readFromResource(fileName) | ||||||
|             .replace("${QID}", qid) |             .replace("${QID}", qid) | ||||||
|             .replace("${LANG}", "\"" + Locale.getDefault().getLanguage() + "\"") |             .replace("${LANG}", "\"" + mainCode + "\"") | ||||||
|             .replace("${LIMIT}", "" + limit) |             .replace("${LIMIT}", "" + limit) | ||||||
|             .replace("${OFFSET}", "" + startPosition); |             .replace("${OFFSET}", "" + startPosition); | ||||||
|         HttpUrl.Builder urlBuilder = HttpUrl |         HttpUrl.Builder urlBuilder = HttpUrl | ||||||
|  |  | ||||||
|  | @ -59,7 +59,7 @@ public class NearbyController extends MapController { | ||||||
|         String fullCode = Locale.getDefault().getLanguage(); |         String fullCode = Locale.getDefault().getLanguage(); | ||||||
|         String mainCode = fullCode.contains(",") ? fullCode.substring(0, fullCode.indexOf(',')).trim() : fullCode; |         String mainCode = fullCode.contains(",") ? fullCode.substring(0, fullCode.indexOf(',')).trim() : fullCode; | ||||||
|         List<Place> places = nearbyPlaces |         List<Place> places = nearbyPlaces | ||||||
|             .radiusExpander(searchLatLng, Locale.getDefault().getLanguage(), returnClosestResult, |             .radiusExpander(searchLatLng, mainCode, returnClosestResult, | ||||||
|                 customQuery); |                 customQuery); | ||||||
| 
 | 
 | ||||||
|         if (null != places && places.size() > 0) { |         if (null != places && places.size() > 0) { | ||||||
|  | @ -141,7 +141,9 @@ public class NearbyController extends MapController { | ||||||
|      * @throws Exception If an error occurs during the retrieval process. |      * @throws Exception If an error occurs during the retrieval process. | ||||||
|      */ |      */ | ||||||
|     public List<Place> getPlaces(List<Place> placeList) throws Exception { |     public List<Place> getPlaces(List<Place> placeList) throws Exception { | ||||||
|         return nearbyPlaces.getPlaces(placeList, Locale.getDefault().getLanguage()); |         String fullCode = Locale.getDefault().getLanguage(); | ||||||
|  |         String mainCode = fullCode.contains(",") ? fullCode.substring(0, fullCode.indexOf(',')).trim() : fullCode; | ||||||
|  |         return nearbyPlaces.getPlaces(placeList, mainCode); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static LatLng calculateNorthEast(double latitude, double longitude, double distance) { |     public static LatLng calculateNorthEast(double latitude, double longitude, double distance) { | ||||||
|  | @ -198,8 +200,11 @@ public class NearbyController extends MapController { | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         String fullCode = Locale.getDefault().getLanguage(); | ||||||
|  |         String mainCode = fullCode.contains(",") ? fullCode.substring(0, fullCode.indexOf(',')).trim() : fullCode; | ||||||
|  | 
 | ||||||
|         List<Place> places = nearbyPlaces.getFromWikidataQuery(screenTopRight, screenBottomLeft, |         List<Place> places = nearbyPlaces.getFromWikidataQuery(screenTopRight, screenBottomLeft, | ||||||
|             Locale.getDefault().getLanguage(), shouldQueryForMonuments, customQuery); |             mainCode, shouldQueryForMonuments, customQuery); | ||||||
| 
 | 
 | ||||||
|         if (null != places && places.size() > 0) { |         if (null != places && places.size() > 0) { | ||||||
|             LatLng[] boundaryCoordinates = { |             LatLng[] boundaryCoordinates = { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Adith
						Adith