@ngx-i18nsupport/ngx-i18nsupport-lib
Version:
A Typescript library to work with Angular generated i18n files (xliff, xmb)
589 lines • 38.9 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { isNullOrUndefined } from 'util';
import { DOMUtilities } from './dom-utilities';
import { AbstractTransUnit } from './abstract-trans-unit';
import { XmbMessageParser } from './xmb-message-parser';
/**
* Created by martin on 23.05.2017.
* A Translation Unit in an XTB file.
*/
var /**
* Created by martin on 23.05.2017.
* A Translation Unit in an XTB file.
*/
XtbTransUnit = /** @class */ (function (_super) {
tslib_1.__extends(XtbTransUnit, _super);
function XtbTransUnit(_element, _id, _translationMessagesFile, _sourceTransUnitFromMaster) {
var _this = _super.call(this, _element, _id, _translationMessagesFile) || this;
_this._sourceTransUnitFromMaster = _sourceTransUnitFromMaster;
return _this;
}
/**
* Get content to translate.
* Source parts are excluded here.
* @return content to translate.
*/
/**
* Get content to translate.
* Source parts are excluded here.
* @return {?} content to translate.
*/
XtbTransUnit.prototype.sourceContent = /**
* Get content to translate.
* Source parts are excluded here.
* @return {?} content to translate.
*/
function () {
if (this._sourceTransUnitFromMaster) {
return this._sourceTransUnitFromMaster.sourceContent();
}
else {
return null;
}
};
/**
* Test, wether setting of source content is supported.
* If not, setSourceContent in trans-unit will do nothing.
* xtb does not support this, all other formats do.
*/
/**
* Test, wether setting of source content is supported.
* If not, setSourceContent in trans-unit will do nothing.
* xtb does not support this, all other formats do.
* @return {?}
*/
XtbTransUnit.prototype.supportsSetSourceContent = /**
* Test, wether setting of source content is supported.
* If not, setSourceContent in trans-unit will do nothing.
* xtb does not support this, all other formats do.
* @return {?}
*/
function () {
return false;
};
/**
* Set new source content in the transunit.
* Normally, this is done by ng-extract.
* Method only exists to allow xliffmerge to merge missing changed source content.
* @param newContent the new content.
*/
/**
* Set new source content in the transunit.
* Normally, this is done by ng-extract.
* Method only exists to allow xliffmerge to merge missing changed source content.
* @param {?} newContent the new content.
* @return {?}
*/
XtbTransUnit.prototype.setSourceContent = /**
* Set new source content in the transunit.
* Normally, this is done by ng-extract.
* Method only exists to allow xliffmerge to merge missing changed source content.
* @param {?} newContent the new content.
* @return {?}
*/
function (newContent) {
// xtb has no source content, they are part of the master
};
/**
* Return a parser used for normalized messages.
*/
/**
* Return a parser used for normalized messages.
* @protected
* @return {?}
*/
XtbTransUnit.prototype.messageParser = /**
* Return a parser used for normalized messages.
* @protected
* @return {?}
*/
function () {
return new XmbMessageParser(); // no typo!, Same as for Xmb
};
/**
* The original text value, that is to be translated, as normalized message.
*/
/**
* The original text value, that is to be translated, as normalized message.
* @return {?}
*/
XtbTransUnit.prototype.createSourceContentNormalized = /**
* The original text value, that is to be translated, as normalized message.
* @return {?}
*/
function () {
if (this._sourceTransUnitFromMaster) {
return this._sourceTransUnitFromMaster.createSourceContentNormalized();
}
else {
return null;
}
};
/**
* the translated value (containing all markup, depends on the concrete format used).
*/
/**
* the translated value (containing all markup, depends on the concrete format used).
* @return {?}
*/
XtbTransUnit.prototype.targetContent = /**
* the translated value (containing all markup, depends on the concrete format used).
* @return {?}
*/
function () {
return DOMUtilities.getXMLContent(this._element);
};
/**
* the translated value, but all placeholders are replaced with {{n}} (starting at 0)
* and all embedded html is replaced by direct html markup.
*/
/**
* the translated value, but all placeholders are replaced with {{n}} (starting at 0)
* and all embedded html is replaced by direct html markup.
* @return {?}
*/
XtbTransUnit.prototype.targetContentNormalized = /**
* the translated value, but all placeholders are replaced with {{n}} (starting at 0)
* and all embedded html is replaced by direct html markup.
* @return {?}
*/
function () {
return this.messageParser().createNormalizedMessageFromXML(this._element, this.sourceContentNormalized());
};
/**
* State of the translation.
* (not supported in xmb)
* If we have a master, we assumed it is translated if the content is not the same as the masters one.
*/
/**
* State of the translation.
* (not supported in xmb)
* If we have a master, we assumed it is translated if the content is not the same as the masters one.
* @return {?}
*/
XtbTransUnit.prototype.nativeTargetState = /**
* State of the translation.
* (not supported in xmb)
* If we have a master, we assumed it is translated if the content is not the same as the masters one.
* @return {?}
*/
function () {
if (this._sourceTransUnitFromMaster) {
/** @type {?} */
var sourceContent = this._sourceTransUnitFromMaster.sourceContent();
if (!sourceContent || sourceContent === this.targetContent() || !this.targetContent()) {
return 'new';
}
else {
return 'final';
}
}
return null; // not supported in xmb
};
/**
* Map an abstract state (new, translated, final) to a concrete state used in the xml.
* Returns the state to be used in the xml.
* @param state one of Constants.STATE...
* @returns a native state (depends on concrete format)
* @throws error, if state is invalid.
*/
/**
* Map an abstract state (new, translated, final) to a concrete state used in the xml.
* Returns the state to be used in the xml.
* @throws error, if state is invalid.
* @protected
* @param {?} state one of Constants.STATE...
* @return {?} a native state (depends on concrete format)
*/
XtbTransUnit.prototype.mapStateToNativeState = /**
* Map an abstract state (new, translated, final) to a concrete state used in the xml.
* Returns the state to be used in the xml.
* @throws error, if state is invalid.
* @protected
* @param {?} state one of Constants.STATE...
* @return {?} a native state (depends on concrete format)
*/
function (state) {
return state;
};
/**
* Map a native state (found in the document) to an abstract state (new, translated, final).
* Returns the abstract state.
* @param nativeState nativeState
*/
/**
* Map a native state (found in the document) to an abstract state (new, translated, final).
* Returns the abstract state.
* @protected
* @param {?} nativeState nativeState
* @return {?}
*/
XtbTransUnit.prototype.mapNativeStateToState = /**
* Map a native state (found in the document) to an abstract state (new, translated, final).
* Returns the abstract state.
* @protected
* @param {?} nativeState nativeState
* @return {?}
*/
function (nativeState) {
return nativeState;
};
/**
* set state in xml.
* (not supported in xmb)
* @param nativeState nativeState
*/
/**
* set state in xml.
* (not supported in xmb)
* @protected
* @param {?} nativeState nativeState
* @return {?}
*/
XtbTransUnit.prototype.setNativeTargetState = /**
* set state in xml.
* (not supported in xmb)
* @protected
* @param {?} nativeState nativeState
* @return {?}
*/
function (nativeState) {
// TODO some logic to store it anywhere
};
/**
* All the source elements in the trans unit.
* The source element is a reference to the original template.
* It contains the name of the template file and a line number with the position inside the template.
* It is just a help for translators to find the context for the translation.
* This is set when using Angular 4.0 or greater.
* Otherwise it just returns an empty array.
*/
/**
* All the source elements in the trans unit.
* The source element is a reference to the original template.
* It contains the name of the template file and a line number with the position inside the template.
* It is just a help for translators to find the context for the translation.
* This is set when using Angular 4.0 or greater.
* Otherwise it just returns an empty array.
* @return {?}
*/
XtbTransUnit.prototype.sourceReferences = /**
* All the source elements in the trans unit.
* The source element is a reference to the original template.
* It contains the name of the template file and a line number with the position inside the template.
* It is just a help for translators to find the context for the translation.
* This is set when using Angular 4.0 or greater.
* Otherwise it just returns an empty array.
* @return {?}
*/
function () {
if (this._sourceTransUnitFromMaster) {
return this._sourceTransUnitFromMaster.sourceReferences();
}
else {
return [];
}
};
/**
* Test, wether setting of source refs is supported.
* If not, setSourceReferences will do nothing.
* xtb does not support this, all other formats do.
*/
/**
* Test, wether setting of source refs is supported.
* If not, setSourceReferences will do nothing.
* xtb does not support this, all other formats do.
* @return {?}
*/
XtbTransUnit.prototype.supportsSetSourceReferences = /**
* Test, wether setting of source refs is supported.
* If not, setSourceReferences will do nothing.
* xtb does not support this, all other formats do.
* @return {?}
*/
function () {
return false;
};
/**
* Set source ref elements in the transunit.
* Normally, this is done by ng-extract.
* Method only exists to allow xliffmerge to merge missing source refs.
* @param sourceRefs the sourcerefs to set. Old ones are removed.
*/
/**
* Set source ref elements in the transunit.
* Normally, this is done by ng-extract.
* Method only exists to allow xliffmerge to merge missing source refs.
* @param {?} sourceRefs the sourcerefs to set. Old ones are removed.
* @return {?}
*/
XtbTransUnit.prototype.setSourceReferences = /**
* Set source ref elements in the transunit.
* Normally, this is done by ng-extract.
* Method only exists to allow xliffmerge to merge missing source refs.
* @param {?} sourceRefs the sourcerefs to set. Old ones are removed.
* @return {?}
*/
function (sourceRefs) {
// xtb has no source refs, they are part of the master
};
/**
* The description set in the template as value of the i18n-attribute.
* e.g. i18n="mydescription".
* In xtb only the master stores it.
*/
/**
* The description set in the template as value of the i18n-attribute.
* e.g. i18n="mydescription".
* In xtb only the master stores it.
* @return {?}
*/
XtbTransUnit.prototype.description = /**
* The description set in the template as value of the i18n-attribute.
* e.g. i18n="mydescription".
* In xtb only the master stores it.
* @return {?}
*/
function () {
if (this._sourceTransUnitFromMaster) {
return this._sourceTransUnitFromMaster.description();
}
else {
return null;
}
};
/**
* The meaning (intent) set in the template as value of the i18n-attribute.
* This is the part in front of the | symbol.
* e.g. i18n="meaning|mydescription".
* In xtb only the master stores it.
*/
/**
* The meaning (intent) set in the template as value of the i18n-attribute.
* This is the part in front of the | symbol.
* e.g. i18n="meaning|mydescription".
* In xtb only the master stores it.
* @return {?}
*/
XtbTransUnit.prototype.meaning = /**
* The meaning (intent) set in the template as value of the i18n-attribute.
* This is the part in front of the | symbol.
* e.g. i18n="meaning|mydescription".
* In xtb only the master stores it.
* @return {?}
*/
function () {
if (this._sourceTransUnitFromMaster) {
return this._sourceTransUnitFromMaster.meaning();
}
else {
return null;
}
};
/**
* Test, wether setting of description and meaning is supported.
* If not, setDescription and setMeaning will do nothing.
* xtb does not support this, all other formats do.
*/
/**
* Test, wether setting of description and meaning is supported.
* If not, setDescription and setMeaning will do nothing.
* xtb does not support this, all other formats do.
* @return {?}
*/
XtbTransUnit.prototype.supportsSetDescriptionAndMeaning = /**
* Test, wether setting of description and meaning is supported.
* If not, setDescription and setMeaning will do nothing.
* xtb does not support this, all other formats do.
* @return {?}
*/
function () {
return false;
};
/**
* Change description property of trans-unit.
* @param description description
*/
/**
* Change description property of trans-unit.
* @param {?} description description
* @return {?}
*/
XtbTransUnit.prototype.setDescription = /**
* Change description property of trans-unit.
* @param {?} description description
* @return {?}
*/
function (description) {
// not supported, do nothing
};
/**
* Change meaning property of trans-unit.
* @param meaning meaning
*/
/**
* Change meaning property of trans-unit.
* @param {?} meaning meaning
* @return {?}
*/
XtbTransUnit.prototype.setMeaning = /**
* Change meaning property of trans-unit.
* @param {?} meaning meaning
* @return {?}
*/
function (meaning) {
// not supported, do nothing
};
/**
* Get all notes of the trans-unit.
* There are NO notes in xmb/xtb
*/
/**
* Get all notes of the trans-unit.
* There are NO notes in xmb/xtb
* @return {?}
*/
XtbTransUnit.prototype.notes = /**
* Get all notes of the trans-unit.
* There are NO notes in xmb/xtb
* @return {?}
*/
function () {
return [];
};
/**
* Test, wether setting of notes is supported.
* If not, setNotes will do nothing.
* xtb does not support this, all other formats do.
*/
/**
* Test, wether setting of notes is supported.
* If not, setNotes will do nothing.
* xtb does not support this, all other formats do.
* @return {?}
*/
XtbTransUnit.prototype.supportsSetNotes = /**
* Test, wether setting of notes is supported.
* If not, setNotes will do nothing.
* xtb does not support this, all other formats do.
* @return {?}
*/
function () {
return false;
};
/**
* Add notes to trans unit.
* @param newNotes the notes to add.
* NOT Supported in xmb/xtb
*/
/**
* Add notes to trans unit.
* @param {?} newNotes the notes to add.
* NOT Supported in xmb/xtb
* @return {?}
*/
XtbTransUnit.prototype.setNotes = /**
* Add notes to trans unit.
* @param {?} newNotes the notes to add.
* NOT Supported in xmb/xtb
* @return {?}
*/
function (newNotes) {
// not supported, do nothing
};
/**
* Copy source to target to use it as dummy translation.
* Returns a changed copy of this trans unit.
* receiver is not changed.
* (internal usage only, a client should call importNewTransUnit on ITranslationMessageFile)
* In xtb there is nothing to do, because there is only a target, no source.
*/
/**
* Copy source to target to use it as dummy translation.
* Returns a changed copy of this trans unit.
* receiver is not changed.
* (internal usage only, a client should call importNewTransUnit on ITranslationMessageFile)
* In xtb there is nothing to do, because there is only a target, no source.
* @param {?} isDefaultLang
* @param {?} copyContent
* @param {?} targetFile
* @return {?}
*/
XtbTransUnit.prototype.cloneWithSourceAsTarget = /**
* Copy source to target to use it as dummy translation.
* Returns a changed copy of this trans unit.
* receiver is not changed.
* (internal usage only, a client should call importNewTransUnit on ITranslationMessageFile)
* In xtb there is nothing to do, because there is only a target, no source.
* @param {?} isDefaultLang
* @param {?} copyContent
* @param {?} targetFile
* @return {?}
*/
function (isDefaultLang, copyContent, targetFile) {
return this;
};
/**
* Copy source to target to use it as dummy translation.
* (internal usage only, a client should call createTranslationFileForLang on ITranslationMessageFile)
*/
/**
* Copy source to target to use it as dummy translation.
* (internal usage only, a client should call createTranslationFileForLang on ITranslationMessageFile)
* @param {?} isDefaultLang
* @param {?} copyContent
* @return {?}
*/
XtbTransUnit.prototype.useSourceAsTarget = /**
* Copy source to target to use it as dummy translation.
* (internal usage only, a client should call createTranslationFileForLang on ITranslationMessageFile)
* @param {?} isDefaultLang
* @param {?} copyContent
* @return {?}
*/
function (isDefaultLang, copyContent) {
// do nothing
};
/**
* Set the translation to a given string (including markup).
* @param translation translation
*/
/**
* Set the translation to a given string (including markup).
* @protected
* @param {?} translation translation
* @return {?}
*/
XtbTransUnit.prototype.translateNative = /**
* Set the translation to a given string (including markup).
* @protected
* @param {?} translation translation
* @return {?}
*/
function (translation) {
/** @type {?} */
var target = this._element;
if (isNullOrUndefined(translation)) {
translation = '';
}
DOMUtilities.replaceContentWithXMLContent(target, translation);
};
return XtbTransUnit;
}(AbstractTransUnit));
/**
* Created by martin on 23.05.2017.
* A Translation Unit in an XTB file.
*/
export { XtbTransUnit };
if (false) {
/**
* @type {?}
* @private
*/
XtbTransUnit.prototype._sourceTransUnitFromMaster;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieHRiLXRyYW5zLXVuaXQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmd4LWkxOG5zdXBwb3J0L25neC1pMThuc3VwcG9ydC1saWIvIiwic291cmNlcyI6WyJpbXBsL3h0Yi10cmFucy11bml0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFDLGlCQUFpQixFQUFDLE1BQU0sTUFBTSxDQUFDO0FBS3ZDLE9BQU8sRUFBQyxZQUFZLEVBQUMsTUFBTSxpQkFBaUIsQ0FBQztBQUM3QyxPQUFPLEVBQUMsaUJBQWlCLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQztBQUN4RCxPQUFPLE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