Closed NagaSainath closed 3 years ago
Please provide more information... don't know what you're trying to do
@adrai Thanks for the quick response. I installed npm xliff version 5.5.2. When I tried to import xliff from 'xliff' or import xliff2js from 'xliff/xliff2js' I get "Could not find a declaration file for module 'xliff'" error on my typescript file. I'm not sure if xliff2js is exports to use?
Sorry, not a TypeScript user... can you provide a reproducible example?
import xliff from 'xliff'
xliff.xliff2js(xml, (err, res) => {})
@adrai I was trying to use this example approach https://developapa.com/angular-localize/
You probably need to tweak your tsconfig or something like that, because xliff has no types at all.
@adrai Thank you very much. that helped
In case someone else stumbles across this issue, here's an xliff.d.ts
file I've used in a TypeScript project that depends on xliff
. It'd be great if a more complete type declaration were available as part of the library or on DefinitelyTyped, but adding this file was all my app needed.
declare module 'xliff' {
export type XliffTranslationString = string;
export interface XliffTranslationObject {
readonly 'Standalone': {
readonly 'id': string,
readonly 'equiv-text': string
};
}
export type XliffTranslationArray = readonly (XliffTranslationString | XliffTranslationObject)[];
export interface XliffFile {
readonly sourceLanguage: string;
readonly targetLanguage: string;
readonly resources: {
readonly 'ng2.template': {
readonly [translationId: string]: {
readonly source: XliffTranslationString | XliffTranslationObject | XliffTranslationArray,
readonly target: XliffTranslationString | XliffTranslationObject | XliffTranslationArray
}
}
};
}
function xliff12ToJs(contents: string): Promise<XliffFile>;
}
Credit to this repo for most of the code.
I believe this should be re-opened.
Typescript is now a commonly used tool for javascript projects, the current solution in this issue is to effectively turn off an important feature that makes projects safer (no undefined types), if possible please may this project provide proper typescript support.
It's open source... Feel free to start a pull request to contribute.
👉 Please follow one of these issue templates 👈
You have already researched for similar issues? Yes
It's not uncommon that somebody already opened an issue or in best case it's already fixed but not merged. That's the reason why you should search at first before submitting a new one. Search also on StackOverflow or similar.
Are you sure this is an issue with locize?
Yes import xliff from 'xliff' import xliff2js from 'xliff/xliff2js'
I can't do anyone of these, can anyone help me on this? is this still working? Appreciate your help Issues should only be posted in this repository after you have been able to reproduce them and confirm that they are a bug or incorrect/missing information in the docs.
Maybe your issue is more related to i18next.com, if so please open an issue here.