mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
Fix missing module declarations, broken lings, broken formating and incorrect scopes in the documentation. For modules split over several files it appears the only viable option is to use the memberof directive on each documented member and only declare the index file as a module.
27 lines
816 B
JavaScript
27 lines
816 B
JavaScript
// Function for parsing factorio locale from a local factorio install
|
|
"use strict";
|
|
const fs = require("fs-extra");
|
|
const path = require("path");
|
|
const ini = require("ini");
|
|
|
|
/**
|
|
* Gets factorios locale as an object, does not respect mods.
|
|
*
|
|
* @param {string} factorioDirectory
|
|
* @param {string} languageCode
|
|
* @param {function} callback
|
|
* @memberof module:lib/factorio
|
|
*/
|
|
async function getLocale(dataDir, languageCode) {
|
|
if (typeof dataDir !== "string") throw new TypeError("dataDir must be a string");
|
|
if (typeof languageCode !== "string") throw new TypeError("languageCode must be a string");
|
|
|
|
let localeFilePath = path.join(dataDir, "base", "locale", languageCode, "base.cfg");
|
|
let content = await fs.readFile(localeFilePath, "utf8");
|
|
return ini.parse(content);
|
|
}
|
|
|
|
module.exports = {
|
|
getLocale,
|
|
};
|