@walletpass/pass-js
Version:
Apple Wallet Pass generating and pushing updates from Node.js
55 lines • 2.22 kB
TypeScript
/**
* Just as in C, some characters must be prefixed with a backslash before you
* can include them in the string. These characters include double quotation
* marks, the backslash character itself, and special control characters such
* as linefeed (\n) and carriage returns (\r).
*
* Apple's spec uses literal LF (
) for `\n` regardless of host OS — the
* previous implementation substituted `os.EOL` (CRLF on Windows) and silently
* produced different output across platforms, breaking cross-platform
* reproducibility of pass bundles.
*
* @see {@link https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html#//apple_ref/doc/uid/10000051i-CH6-SW13}
*/
export declare function escapeString(str: string): string;
export declare function unescapeString(str: string): string;
/**
* @see {@link https://github.com/justinklemm/i18n-strings-files/blob/dae303ed60d9d43dbe1a39bb66847be8a0d62c11/index.coffee#L100}
* @param {string} filename - path to pass.strings file
*/
export declare function readLprojStrings(filename: string): Promise<Map<string, string>>;
/**
* Converts given translations map into UTF-16 encoded buffer in .lproj format
*
* @param {Map.<string, string>} strings
*/
export declare function getLprojBuffer(strings: Map<string, string>): Buffer;
/**
* Localizations class Map<lang, Map<key, translation>>
*/
export declare class Localizations extends Map<string, Map<string, string>> {
constructor(v?: Localizations);
/**
*
* @param {string} lang - ISO 3166 alpha-2 code for the language
* @param {{ [k: string]?: string }} values
*/
add(lang: string, values: {
[k: string]: string;
}): this;
toArray(): {
path: string;
data: Buffer;
}[];
addFile(language: string, filename: string): Promise<void>;
addFromStream(language: string, stream: import('stream').Readable): Promise<void>;
addFromBuffer(language: string, buffer: Buffer): Promise<void>;
/**
* Loads available localizations from given folder path
*
* @param {string} dirPath
*/
load(dirPath: string): Promise<void>;
}
//# sourceMappingURL=localizations.d.ts.map