UNPKG

@criticalmanufacturing/dev-i18n-transform

Version:
65 lines (64 loc) 1.88 kB
import { Message } from "./message"; export declare class File { private _dirname; private _filename; private _extension; private readonly _messages; /** * Gets the list of file references */ readonly references: string[]; /** * Gets the file name */ get uniqueFileName(): string; /** * Gets all file messages */ get messages(): Message[]; /** * File model constructor * @param filename Path to the file to create * @param packagePath Path of the package where the file is in */ constructor(filename: string, packagePath?: string); /** * Adds or updates a message to the current file * * @param message The message to be added */ addOrUpdateMessage(message: Message): void; /** * Add or updates a reference to the current file * @param reference Reference to add */ addOrUpdateReference(reference: string): void; /** * Gets a given message from the file * @param id Message id * @returns Null if id doesn't exist, the Message otherwise */ getMessage(id: string): Message; /** * Merges the given file into the current * @param file File to merge * @throws Argument null error if file is not defined */ merge(file: File): void; /** * Gets the translated file name * @param language Language code of the file */ translatedFileName(language: string): string; /** * Parses the given filename into a easy to handle structure * @param filename Filename to parse * @return Decomposed file name */ static parseFileName(filename: string, packagePath?: string): { name: string; language: string; extension: string; path: string; }; }