forked from MapComplete/MapComplete
		
	Fix fetchLanguage, regenerate language overview
This commit is contained in:
		
							parent
							
								
									657168e1f3
								
							
						
					
					
						commit
						06998172f0
					
				
					 3 changed files with 308 additions and 143 deletions
				
			
		|  | @ -149,7 +149,6 @@ | |||
|   ], | ||||
|   "CY": [ | ||||
|     "tr", | ||||
|     "el", | ||||
|     "el" | ||||
|   ], | ||||
|   "CZ": [ | ||||
|  | @ -249,9 +248,6 @@ | |||
|     "es", | ||||
|     "pt" | ||||
|   ], | ||||
|   "GR": [ | ||||
|     "el" | ||||
|   ], | ||||
|   "GT": [ | ||||
|     "es" | ||||
|   ], | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -9,12 +9,12 @@ import ScriptUtils from "./ScriptUtils" | |||
| import { existsSync, readFileSync, writeFileSync } from "fs" | ||||
| import WikidataUtils from "../Utils/WikidataUtils" | ||||
| import LanguageUtils from "../Utils/LanguageUtils" | ||||
| import Wikidata from "../Logic/Web/Wikidata"; | ||||
| import Wikidata from "../Logic/Web/Wikidata" | ||||
| 
 | ||||
| interface value<T> { | ||||
|     value: T, | ||||
|     value: T | ||||
|     type: "uri" | "literal" | string | ||||
|     'xml:lang'?: string | ||||
|     "xml:lang"?: string | ||||
| } | ||||
| 
 | ||||
| interface LanguageSpecResult { | ||||
|  | @ -55,10 +55,10 @@ async function fetchRegularLanguages() { | |||
|     const pt_br = await fetchSpecial(750553, "pt_BR") | ||||
|     const punjabi = await fetchSpecial(58635, "pa_PK") | ||||
|     const Shahmukhi = await Wikidata.LoadWikidataEntryAsync(133800) | ||||
| 
 | ||||
|   punjabi.forEach(item => { | ||||
|       const native = Shahmukhi.find(item => item.label["xml:lang"] == item.label["xml:lang"]) ??"Shahmukhi"; | ||||
|       return item.label.value = item.label + " (" +native+")"; | ||||
|     punjabi.forEach((item) => { | ||||
|         const neededLanguage = item.label["xml:lang"] | ||||
|         const native = Shahmukhi.labels.get(neededLanguage) ?? Shahmukhi.labels.get("en") | ||||
|         item.label.value = item.label.value + " (" + native + ")" | ||||
|     }) | ||||
| 
 | ||||
|     const fil = await fetchSpecial(33298, "fil") | ||||
|  | @ -81,13 +81,15 @@ async function fetchSpecial(id: number, code: string) : Promise< LanguageSpecRes | |||
|     ScriptUtils.fixUtils() | ||||
|     console.log("Fetching languages") | ||||
| 
 | ||||
|     const lang =  "  wd:Q" +        id; | ||||
|     const lang = "  wd:Q" + id | ||||
|     const sparql = | ||||
|         "SELECT ?label ?directionalityLabel \n" + | ||||
|         "WHERE \n" + | ||||
|         "{ \n" + | ||||
|         lang + " rdfs:label ?label." + | ||||
|       lang+   " wdt:P282 ?writing_system. \n" + | ||||
|         lang + | ||||
|         " rdfs:label ?label." + | ||||
|         lang + | ||||
|         " wdt:P282 ?writing_system. \n" + | ||||
|         "  ?writing_system wdt:P1406 ?directionality. \n" + | ||||
|         '  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } \n' + | ||||
|         "} " | ||||
|  | @ -196,6 +198,6 @@ async function main(wipeCache = false) { | |||
|     writeFileSync("./assets/language_translations.json", JSON.stringify(translations, null, "  ")) | ||||
| } | ||||
| 
 | ||||
| const forceRefresh = true || process.argv[2] === "--force-refresh" | ||||
| const forceRefresh = process.argv[2] === "--force-refresh" | ||||
| ScriptUtils.fixUtils() | ||||
| main(forceRefresh).then(() => console.log("Done!")) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue