import _countries from "@/assets/countries.min.json"; import LANG_FLAGS from "@/langs-flags-list/lang-flags.json" import { language_matrix_entry } from "./api"; import { lang_a2_a3 } from "./lang"; export const countries = _countries; export function chooseCountry(lang_a2 : string) { const lang_a3 = lang_a2_a3(lang_a2); if (!lang_a3) throw new Error(`Could not find alpha3 code of ${lang_a2}`); const cs = countries.filter( c => c.languages.includes(lang_a3.alpha3) ); console.log("cc = %x, ", cs.map(c => c.alpha2)) return cs.filter(cc => Object.keys(LANG_FLAGS).includes(cc.alpha2.toLowerCase())).map(c => c.alpha2.toLowerCase()); }