mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Django/Jinja
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Django/Jinja
		
	
	
	
	
	
| /*
 | |
| This file is auto-generated from a template (/scripts/templates).
 | |
| If you need to modify it, make sure to modify the template, not this file.
 | |
| */
 | |
| package org.wikipedia.staticdata;
 | |
| 
 | |
| import android.support.annotation.NonNull;
 | |
| 
 | |
| import java.util.Collections;
 | |
| import java.util.HashMap;
 | |
| import java.util.Map;
 | |
| 
 | |
| public final class {{class_name}} {
 | |
|     @NonNull private static final Map<String, String> DATA_MAP = Collections.unmodifiableMap(newMap());
 | |
| 
 | |
|     @NonNull public static String valueFor(String key) {
 | |
|         if (DATA_MAP.containsKey(key)) {
 | |
|             return DATA_MAP.get(key);
 | |
|         }
 | |
|         return DATA_MAP.get("en");
 | |
|     }
 | |
| 
 | |
|     @SuppressWarnings({"checkstyle:methodlength", "SpellCheckingInspection"})
 | |
|     private static Map<String, String> newMap() {
 | |
|         final int size = {{wikis|length}};
 | |
|         Map<String, String> map = new HashMap<>(size);
 | |
| 
 | |
|         {%- for wiki in wikis %}
 | |
|         map.put("{{wiki.lang}}", "{{wiki.props[key]}}");
 | |
|         {%- endfor %}
 | |
|         return map;
 | |
|     }
 | |
| 
 | |
|     private {{class_name}}() { }
 | |
| }
 | |
| 
 | 
