import fs from "fs/promises" ; import path from "path" ; import { Backend } from "../backend" ; export class FileSystemBackend implements Backend { constructor ( private basePath = "./public/locales" ) { } async getTranslations ( namespace , locale ) { const data = await fs . readFile ( path . resolve ( path . join ( this . basePath , locale , `${ namespace }.json` ) ) , "utf-8" ) ; return JSON . parse ( data ) ; } }