angular-phrase
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -9,5 +9,5 @@ /******/ (function(modules) { // webpackBootstrap | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
@@ -37,16 +37,33 @@ /******/ var module = installedModules[moduleId] = { | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = function(exports) { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ | ||
/******/ // create a fake namespace object | ||
/******/ // mode & 1: value is a module id, require it | ||
/******/ // mode & 2: merge all properties of value into the ns | ||
/******/ // mode & 4: return value when already ns object | ||
/******/ // mode & 8|1: behave like require | ||
/******/ __webpack_require__.t = function(value, mode) { | ||
/******/ if(mode & 1) value = __webpack_require__(value); | ||
/******/ if(mode & 8) return value; | ||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; | ||
/******/ var ns = Object.create(null); | ||
/******/ __webpack_require__.r(ns); | ||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); | ||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); | ||
/******/ return ns; | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
@@ -67,17 +84,55 @@ /******/ __webpack_require__.n = function(module) { | ||
/******/ | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 1); | ||
/******/ return __webpack_require__(__webpack_require__.s = "./src/angular-phrase.ts"); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports) { | ||
/******/ ({ | ||
module.exports = angular; | ||
/***/ "./src/Data_utils.ts": | ||
/*!***************************!*\ | ||
!*** ./src/Data_utils.ts ***! | ||
\***************************/ | ||
/*! exports provided: default */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
var DataUtils = /** @class */ (function () { | ||
function DataUtils() { | ||
} | ||
DataUtils.getScript = function (source, callback) { | ||
var script = document.createElement('script'); | ||
var prior = document.getElementsByTagName('script')[0]; | ||
script.async = true; | ||
script.onload = script.onreadystatechange = function (_, isAbort) { | ||
if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) { | ||
script.onload = script.onreadystatechange = null; | ||
script = undefined; | ||
if (!isAbort && callback) | ||
setTimeout(callback, 0); | ||
} | ||
}; | ||
script.src = source; | ||
prior.parentNode.insertBefore(script, prior); | ||
}; | ||
return DataUtils; | ||
}()); | ||
/* harmony default export */ __webpack_exports__["default"] = (DataUtils); | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* WEBPACK VAR INJECTION */(function(angular) {var phrase = angular.module("phrase", ['pascalprecht.translate', 'ng']); | ||
/***/ "./src/angular-phrase.ts": | ||
/*!*******************************!*\ | ||
!*** ./src/angular-phrase.ts ***! | ||
\*******************************/ | ||
/*! no exports provided */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony import */ var _Data_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Data_utils */ "./src/Data_utils.ts"); | ||
var phrase = angular.module("phrase", ['pascalprecht.translate', 'ng']); | ||
phrase.value("phraseProjectId", ""); | ||
@@ -89,8 +144,7 @@ phrase.value("phraseEnabled", true); | ||
phrase.config(["$provide", function ($provide) { | ||
return $provide.decorator("$translate", ["$delegate", "phraseEnabled", "phraseDecoratorPrefix", "phraseDecoratorSuffix", function ($translate, phraseEnabled, phraseDecoratorPrefix, phraseDecoratorSuffix) { | ||
return $provide.decorator("$translate", ["$delegate", "phraseEnabled", "phraseDecoratorPrefix", "phraseDecoratorSuffix", | ||
function ($translate, phraseEnabled, phraseDecoratorPrefix, phraseDecoratorSuffix) { | ||
if (phraseEnabled) { | ||
$translate._instant = $translate.instant; | ||
$translate.instant = function (translationId, interpolateParams, interpolationId) { | ||
return phraseDecoratorPrefix + "phrase_" + translationId + phraseDecoratorSuffix; | ||
}; | ||
$translate.instant = function (translationId) { return phraseDecoratorPrefix + "phrase_" + (translationId + phraseDecoratorSuffix); }; | ||
} | ||
@@ -101,3 +155,4 @@ return $translate; | ||
phrase.config(["$compileProvider", function ($compileProvider) { | ||
return $compileProvider.directive('translate', ["phraseEnabled", "phraseDecoratorPrefix", "phraseDecoratorSuffix", function (phraseEnabled, phraseDecoratorPrefix, phraseDecoratorSuffix) { | ||
return $compileProvider.directive('translate', ["phraseEnabled", "phraseDecoratorPrefix", "phraseDecoratorSuffix", | ||
function (phraseEnabled, phraseDecoratorPrefix, phraseDecoratorSuffix) { | ||
if (!phraseEnabled) { | ||
@@ -114,11 +169,14 @@ return {}; | ||
if (elem.attr("translate") != undefined) { | ||
if (elem.attr("translate") != "") | ||
if (elem.attr("translate") !== "") { | ||
translationId = elem.attr("translate"); | ||
else | ||
} | ||
else { | ||
translationId = elem.text(); | ||
} | ||
} | ||
if (translationId) { | ||
var decoratedTranslationId = phraseDecoratorPrefix + 'phrase_' + translationId + phraseDecoratorSuffix; | ||
if (attr.translateValues) | ||
decoratedTranslationId = decoratedTranslationId + ' (' + attr.translateValues + ')'; | ||
var decoratedTranslationId = phraseDecoratorPrefix + "phrase_" + (translationId + phraseDecoratorSuffix); | ||
if (attr.translateValues) { | ||
decoratedTranslationId = decoratedTranslationId + " (" + attr.translateValues + ")"; | ||
} | ||
elem.html(decoratedTranslationId); | ||
@@ -131,3 +189,4 @@ elem.removeAttr("translate"); | ||
}]); | ||
phrase.directive("phraseJavascript", ["phraseEnabled", "phraseProjectId", "phraseAutoLowercase", "$window", function (phraseEnabled, phraseProjectId, phraseAutoLowercase, $window) { | ||
phrase.directive("phraseJavascript", ["phraseEnabled", "phraseProjectId", "phraseAutoLowercase", "$window", | ||
function (phraseEnabled, phraseProjectId, phraseAutoLowercase, $window) { | ||
return { | ||
@@ -138,3 +197,3 @@ restrict: "EA", | ||
if (phraseEnabled) { | ||
var url = ['https://', 'phraseapp.com/assets/in-context-editor/2.0/app.js?', new Date().getTime()].join(''); | ||
var url = "https://phraseapp.com/assets/in-context-editor/2.0/app.js?" + new Date().getTime(); | ||
$window.PHRASEAPP_CONFIG = { | ||
@@ -144,3 +203,3 @@ projectId: phraseProjectId, | ||
}; | ||
$window.jQuery.getScript(url); | ||
_Data_utils__WEBPACK_IMPORTED_MODULE_0__["default"].getScript(url); | ||
} | ||
@@ -151,6 +210,6 @@ } | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) | ||
/***/ }) | ||
/******/ ]); | ||
//# sourceMappingURL=angular-phrase.js.map | ||
/******/ }); | ||
//# sourceMappingURL=angular-phrase.js.map |
@@ -1,1 +0,2 @@ | ||
!function(e){function r(a){if(t[a])return t[a].exports;var module=t[a]={i:a,l:!1,exports:{}};return e[a].call(module.exports,module,module.exports,r),module.l=!0,module.exports}var t={};return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(exports,e,t){r.o(exports,e)||Object.defineProperty(exports,e,{configurable:!1,enumerable:!0,get:t})},r.n=function(module){var e=module&&module.__esModule?function(){return module.default}:function(){return module};return r.d(e,"a",e),e},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=1)}([function(module,exports){module.exports=angular},function(module,exports,e){(function(angular){var e=angular.module("phrase",["pascalprecht.translate","ng"]);e.value("phraseProjectId",""),e.value("phraseEnabled",!0),e.value("phraseDecoratorPrefix","{{__"),e.value("phraseDecoratorSuffix","__}}"),e.value("phraseAutoLowercase",!0),e.config(["$provide",function(e){return e.decorator("$translate",["$delegate","phraseEnabled","phraseDecoratorPrefix","phraseDecoratorSuffix",function(e,r,t,a){return r&&(e._instant=e.instant,e.instant=function(e,r,n){return t+"phrase_"+e+a}),e}])}]),e.config(["$compileProvider",function(e){return e.directive("translate",["phraseEnabled","phraseDecoratorPrefix","phraseDecoratorSuffix",function(e,r,t){return e?{priority:1001,terminal:!0,restrict:"AE",scope:!0,compile:function(e,a){var n;if(void 0!=e.attr("translate")&&(n=""!=e.attr("translate")?e.attr("translate"):e.text()),n){var o=r+"phrase_"+n+t;a.translateValues&&(o=o+" ("+a.translateValues+")"),e.html(o),e.removeAttr("translate")}}}:{}}])}]),e.directive("phraseJavascript",["phraseEnabled","phraseProjectId","phraseAutoLowercase","$window",function(e,r,t,a){return{restrict:"EA",replace:!0,link:function(){if(e){var n=["https://","phraseapp.com/assets/in-context-editor/2.0/app.js?",(new Date).getTime()].join("");a.PHRASEAPP_CONFIG={projectId:r,autoLowercase:t},a.jQuery.getScript(n)}}}}])}).call(exports,e(0))}]); | ||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t);var n=function(){function e(){}return e.getScript=function(e,t){var r=document.createElement("script"),n=document.getElementsByTagName("script")[0];r.async=!0,r.onload=r.onreadystatechange=function(e,n){(n||!r.readyState||/loaded|complete/.test(r.readyState))&&(r.onload=r.onreadystatechange=null,r=void 0,!n&&t&&setTimeout(t,0))},r.src=e,n.parentNode.insertBefore(r,n)},e}(),a=angular.module("phrase",["pascalprecht.translate","ng"]);a.value("phraseProjectId",""),a.value("phraseEnabled",!0),a.value("phraseDecoratorPrefix","{{__"),a.value("phraseDecoratorSuffix","__}}"),a.value("phraseAutoLowercase",!0),a.config(["$provide",function(e){return e.decorator("$translate",["$delegate","phraseEnabled","phraseDecoratorPrefix","phraseDecoratorSuffix",function(e,t,r,n){return t&&(e._instant=e.instant,e.instant=function(e){return r+"phrase_"+(e+n)}),e}])}]),a.config(["$compileProvider",function(e){return e.directive("translate",["phraseEnabled","phraseDecoratorPrefix","phraseDecoratorSuffix",function(e,t,r){return e?{priority:1001,terminal:!0,restrict:"AE",scope:!0,compile:function(e,n){var a;if(null!=e.attr("translate")&&(a=""!==e.attr("translate")?e.attr("translate"):e.text()),a){var o=t+"phrase_"+(a+r);n.translateValues&&(o=o+" ("+n.translateValues+")"),e.html(o),e.removeAttr("translate")}}}:{}}])}]),a.directive("phraseJavascript",["phraseEnabled","phraseProjectId","phraseAutoLowercase","$window",function(e,t,r,a){return{restrict:"EA",replace:!0,link:function(){if(e){var o="https://phraseapp.com/assets/in-context-editor/2.0/app.js?"+(new Date).getTime();a.PHRASEAPP_CONFIG={projectId:t,autoLowercase:r},n.getScript(o)}}}}])}]); | ||
//# sourceMappingURL=angular-phrase.min.js.map |
{ | ||
"name": "angular-phrase", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Use angular-translate with the powerful PhraseApp In-Context-Editor for easy translation management in AngularJS applications", | ||
@@ -10,5 +10,7 @@ "repository": { | ||
"scripts": { | ||
"pretest": "bower install; NODE_ENV=production webpack", | ||
"test": "./node_modules/karma/bin/karma start --single-run", | ||
"build": "webpack" | ||
"test": "npm lint | karma start --single-run", | ||
"start": "webpack --mode development --w", | ||
"build": "webpack --mode development | webpack --mode production", | ||
"lint": "eslint src/**", | ||
"fix": "eslint --fix src/**" | ||
}, | ||
@@ -18,18 +20,23 @@ "author": "Manuel Boy <support@phraseapp.com> (https://phraseapp.com)", | ||
"devDependencies": { | ||
"awesome-typescript-loader": "^3.0.8", | ||
"bower": "^1.5.3", | ||
"jasmine": "^2.5.3", | ||
"karma": "^1.5.0", | ||
"@types/angular": "^1.6.56", | ||
"@types/angular-mocks": "^1.7.0", | ||
"@types/jasmine": "^3.4.3", | ||
"@typescript-eslint/eslint-plugin": "^2.3.3", | ||
"@typescript-eslint/parser": "^2.3.3", | ||
"angular": "^1.7.8", | ||
"angular-mocks": "^1.7.8", | ||
"angular-translate": "^2.18.1", | ||
"eslint": "^6.5.1", | ||
"karma": "^4.3.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-coffee-preprocessor": "^0.1.3", | ||
"karma-firefox-launcher": "^0.1.6", | ||
"karma-html2js-preprocessor": "^0.1.0", | ||
"karma-jasmine": "^1.1.0", | ||
"karma-phantomjs-launcher": "^0.1.4", | ||
"karma-script-launcher": "^0.1.0", | ||
"karma-typescript-preprocessor": "^0.3.1", | ||
"karma-webpack": "^2.0.2", | ||
"source-map-loader": "^0.1.6", | ||
"typescript": "^2.2.1", | ||
"webpack": "^2.2.1" | ||
"karma-firefox-launcher": "^1.2.0", | ||
"karma-jasmine": "^2.0.1", | ||
"karma-spec-reporter": "^0.0.32", | ||
"karma-webpack": "^4.0.2", | ||
"source-map-loader": "^0.2.4", | ||
"terser-webpack-plugin": "^2.1.3", | ||
"ts-loader": "^6.2.0", | ||
"typescript": "^3.6.4", | ||
"webpack": "^4.41.0", | ||
"webpack-cli": "^3.3.9" | ||
}, | ||
@@ -36,0 +43,0 @@ "files": [ |
@@ -5,3 +5,3 @@ # angular-phrase | ||
angular-phrase is an addon for [angular-translate](https://github.com/angular-translate/angular-translate) that lets you connect localized AngularJS applications to the PhraseApp In-Context Editor. | ||
angular-phrase is an addon for [angular-translate](https://github.com/angular-translate/angular-translate) that lets you connect localized AngularJS applications to the Phrase In-Context Editor. | ||
@@ -12,5 +12,4 @@ ## Prerequisites | ||
* Sign up for a PhraseApp account: [https://phraseapp.com/en/signup](https://phraseapp.com/en/signup) | ||
* Sign up for a Phrase account: [https://phrase.com/en/signup](https://phrase.com/en/signup) | ||
* Use the excellent [angular-translate](https://github.com/angular-translate/angular-translate) module by Pascal Precht for localization in your AngularJS app | ||
* Have jQuery included | ||
@@ -33,5 +32,5 @@ ## Demo | ||
### via Bower: | ||
### via YARN: | ||
bower install angular-phrase | ||
yarn add angular-phrase | ||
@@ -44,8 +43,4 @@ (or download it manually from the `dist` folder) | ||
grunt build | ||
npm build | ||
### Development | ||
typings install dt~angular@1.2 --global | ||
### Add the module | ||
@@ -55,3 +50,3 @@ | ||
var myApp = angular.module("myApp", ['pascalprecht.translate', 'phrase']) | ||
const myApp = angular.module("myApp", ['pascalprecht.translate', 'phrase']) | ||
@@ -67,3 +62,3 @@ ### Configure | ||
You can find the Project-ID in the Project overview in the PhraseApp Translation Center | ||
You can find the Project-ID in the Project overview in the Phrase Translation Center | ||
@@ -76,3 +71,3 @@ ### JavaScript snippet | ||
If this does not work for you, you can also integrate the [JavaScript snippet manually](http://docs.phraseapp.com/guides/in-context-editor/custom-integration/). | ||
If this does not work for you, you can also integrate the [JavaScript snippet manually](https://help.phrase.com/en/articles/2183908-integrate-in-context-editor-into-any-web-framework/). | ||
@@ -83,3 +78,3 @@ ## How does it work? | ||
* override the $translate service and provide placeholders that can be picked up by the PhraseApp [In-Context Editor](https://phraseapp.com/features) | ||
* override the $translate service and provide placeholders that can be picked up by the Phrase [In-Context Editor](https://phrase.com/features) | ||
@@ -121,3 +116,3 @@ * fetch the JavaScript application used to render the In-Context Editor on top of your application | ||
**Question?** Contact us at: [phraseapp.com/contact](https://phraseapp.com/contact) | ||
**Question?** Contact us at: [phrase.com/contact](https://phrase.com/contact) | ||
@@ -128,4 +123,4 @@ **Issue?** use GitHub issues and share the problem | ||
Run unit tests using grunt/Karma: | ||
Run unit tests using Karma with webpack: | ||
grunt karma:unit | ||
npm test |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
40574
8
204
0
21
117