7436bf6e2e
C changes: - gstorage.c: encode continent into root key for --persist --restore survival - gholder.c: decode continent from root + lat/lng storage - commons.h: add lat/lng fields to GMetrics struct - geoip2.c/geoip1.h: extract coordinates from MMDB - json.c: output lat/lng in geolocation JSON JS changes: - Remove cityIndex guard for static HTML city dots - TopoJSON lat/lng fallback for city coordinates - updateMap fallback city collection - Dynamic orthographic center based on visitor count - Mercator stays at [0,15] for full world view Co-Authored-By: Claude <noreply@anthropic.com>
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
// init the inlang.config
|
|
|
|
/**
|
|
* @type {import("@inlang/core/config").DefineConfig}
|
|
*/
|
|
export async function defineConfig(env) {
|
|
// importing plugin from local file for testing purposes
|
|
const plugin = await env.$import(
|
|
"https://cdn.jsdelivr.net/gh/jannesblobel/inlang-plugin-po@1/dist/index.js"
|
|
);
|
|
const pluginConfig = {
|
|
// language mean the name of you file
|
|
pathPattern: "./po/{language}.po",
|
|
referenceResourcePath: "./po/goaccess.pot",
|
|
};
|
|
|
|
return {
|
|
// if your project use a pot file use the pot as the reference Language
|
|
// !! do not add the pot file in the Languages array
|
|
/**
|
|
* @example
|
|
* example files: en.pot, de.po, es.po, fr.po
|
|
* referenceLanguage: "en",
|
|
languages: ["de","es","fr"],
|
|
*/
|
|
referenceLanguage: "en",
|
|
languages: await getLanguages(env),
|
|
readResources: (args) =>
|
|
plugin.readResources({ ...args, ...env, pluginConfig }),
|
|
writeResources: (args) =>
|
|
plugin.writeResources({ ...args, ...env, pluginConfig }),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Automatically derives the languages in this repository.
|
|
*/
|
|
async function getLanguages(env) {
|
|
const files = await env.$fs.readdir("./po");
|
|
// files that end with .json
|
|
// remove the .json extension to only get language name
|
|
const languages = files
|
|
.filter((name) => name.endsWith(".po"))
|
|
.map((name) => name.replace(".po", ""));
|
|
return languages;
|
|
}
|