UNPKG

@sap-ux/project-access

Version:

Library to access SAP Fiori tools projects

78 lines 3.94 kB
import type { NewI18nEntry } from '@sap-ux/i18n'; import type { I18nPropertiesPaths } from '../../types'; import type { Editor } from 'mem-fs-editor'; /** * Maintains new translation entries in CAP i18n files. * * @param root project root. * @param filePath absolute path to file in which the translation entry will be used. * @param newI18nEntries translation entries to write in the i18n file. * @param fs optional `mem-fs-editor` instance. If provided, `mem-fs-editor` api is used instead of `fs` of node * In case of CAP project, some CDS APIs are used internally which depends on `fs` of node and not `mem-fs-editor`. * When calling this function, adding or removing a CDS file in memory or changing CDS configuration will not be considered until present on real file system. * @returns boolean or exception */ export declare function createCapI18nEntries(root: string, filePath: string, newI18nEntries: NewI18nEntry[], fs?: Editor): Promise<boolean>; /** * Maintains new translation entries in an existing i18n file or in a new i18n properties file if it does not exist. * * @param root project root * @param manifestPath absolute path to `manifest.json` file * @param i18nPropertiesPaths paths to `.properties` file` * @param newEntries translation entries to write in the `.properties` file * @param modelKey i18n model key * @param fs optional `mem-fs-editor` instance. If provided, `mem-fs-editor` api is used instead of `fs` of node * @returns boolean or exception * @description It also update `manifest.json` file if `<modelKey>` entry is missing from `"sap.ui5":{"models": {}}` * as * ```JSON * { * "sap.ui5": { * "models": { * "<modelKey>": { * "type": "sap.ui.model.resource.ResourceModel", * "uri": "i18n/i18n.properties" * } * } * } * } * ``` */ export declare function createUI5I18nEntries(root: string, manifestPath: string, i18nPropertiesPaths: I18nPropertiesPaths, newEntries: NewI18nEntry[], modelKey: string, fs?: Editor): Promise<boolean>; /** * Maintains new translation entries in an existing i18n file or in a new i18n properties file if it does not exist. * * @param root project root * @param manifestPath absolute path to `manifest.json` file * @param i18nPropertiesPaths paths to `.properties` file` * @param newEntries translation entries to write in the `.properties` file * @param fs optional `mem-fs-editor` instance. If provided, `mem-fs-editor` api is used instead of `fs` of node * @returns boolean or exception * @description It also update `manifest.json` file if `@i18n` entry is missing from `"sap.ui5":{"models": {}}` * as * ```JSON * { * "sap.ui5": { * "models": { * "@i18n": { * "type": "sap.ui.model.resource.ResourceModel", * "uri": "i18n/i18n.properties" * } * } * } * } * ``` */ export declare function createAnnotationI18nEntries(root: string, manifestPath: string, i18nPropertiesPaths: I18nPropertiesPaths, newEntries: NewI18nEntry[], fs?: Editor): Promise<boolean>; /** * Maintains new translation entries in an existing i18n file or in a new i18n properties file if it does not exist. * * @param root project root * @param i18nPropertiesPaths paths to `.properties` file` * @param newEntries translation entries to write in the `.properties` file * @param fs optional `mem-fs-editor` instance. If provided, `mem-fs-editor` api is used instead of `fs` of node * @returns boolean or exception * @description If `i18n` entry is missing from `"sap.app":{}`, default `i18n/i18n.properties` is used. Update of `manifest.json` file is not needed. */ export declare function createManifestI18nEntries(root: string, i18nPropertiesPaths: I18nPropertiesPaths, newEntries: NewI18nEntry[], fs?: Editor): Promise<boolean>; //# sourceMappingURL=write.d.ts.map