PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,68 @@
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
(function () {
angular.module('piwikApp').controller('TranslationSearchController', TranslationSearchController);
TranslationSearchController.$inject = ['piwikApi'];
function TranslationSearchController(piwikApi) {
function fetchTranslations(languageCode) {
piwikApi.fetch({
method: 'LanguagesManager.getTranslationsForLanguage',
filter_limit: -1,
languageCode: languageCode
}).then(function (response) {
if (response) {
if (languageCode === 'en') {
vm.existingTranslations = response;
} else {
vm.compareTranslations = {};
angular.forEach(response, function (translation) {
vm.compareTranslations[translation.label] = translation.value;
});
}
}
});
}
function fetchLanguages() {
piwikApi.fetch({
method: 'LanguagesManager.getAvailableLanguagesInfo',
filter_limit: -1
}).then(function (languages) {
vm.languages = [{key: '', value: 'None'}];
if (languages) {
angular.forEach(languages, function (language) {
if (language.code === 'en') {
return;
}
vm.languages.push({key: language.code, value: language.name});
});
}
});
}
var vm = this;
vm.compareTranslations = null;
vm.existingTranslations = [];
vm.languages = [];
vm.compareLanguage = '';
this.doCompareLanguage = function () {
if (vm.compareLanguage) {
vm.compareTranslations = null;
fetchTranslations(vm.compareLanguage);
}
};
fetchTranslations('en');
fetchLanguages();
}
})();

View File

@ -0,0 +1,44 @@
<div>
<p>
This page helps you to find existing translations that you can reuse in your Plugin.
If you want to know more about translations have a look at our <a href="https://developer.matomo.org/guides/internationalization" rel="noreferrer noopener" target="_blank">Internationalization guide</a>.
Enter a search term to find translations and their corresponding keys:
</p>
<div piwik-field uicontrol="text" name="alias"
inline-help="Search for English translation. Max 1000 results will be shown."
ng-model="translationSearch.searchTerm"
placeholder="Search for English translation">
</div>
<div piwik-field uicontrol="select" name="translationSearch.compareLanguage"
inline-help="Optionally select a language to compare the English language with."
ng-model="translationSearch.compareLanguage"
ng-change="translationSearch.doCompareLanguage()"
options='translationSearch.languages'>
</div>
<br />
<br />
<table piwik-content-table
ng-show="translationSearch.searchTerm"
style="word-break: break-all;">
<thead>
<tr>
<th style="width:250px;">Key</th>
<th>English translation</th>
<th ng-show="translationSearch.compareLanguage && translationSearch.compareTranslations">Compare translation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="translation in translationSearch.existingTranslations | filter:translationSearch.searchTerm | limitTo: 1000">
<td>{{ translation.label }}</td>
<td>{{ translation.value }}</td>
<td ng-show="translationSearch.compareLanguage && translationSearch.compareTranslations">{{ translationSearch.compareTranslations[translation.label] }}</td>
</tr>
</tbody>
</table>
</div>

View File

@ -0,0 +1,31 @@
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/**
* Usage:
*
* <div piwik-translation-search></div>
*
* Will show a text box which allows the user to search for translation keys and actual translations. Currently,
* only english is supported.
*/
(function () {
angular.module('piwikApp').directive('piwikTranslationSearch', piwikTranslationSearch);
piwikTranslationSearch.$inject = ['piwik'];
function piwikTranslationSearch(piwik){
return {
restrict: 'A',
scope: {},
templateUrl: 'plugins/LanguagesManager/angularjs/translationsearch/translationsearch.directive.html?cb=' + piwik.cacheBuster,
controller: 'TranslationSearchController',
controllerAs: 'translationSearch'
};
}
})();