Skip to content

Commit

Permalink
Merge branch 'canary'
Browse files Browse the repository at this point in the history
Conflicts:
	bower.json
	package.json
  • Loading branch information
knalli committed Sep 22, 2014
2 parents 35002e1 + 8fc13fa commit 7ac5be0
Show file tree
Hide file tree
Showing 39 changed files with 657 additions and 82 deletions.
24 changes: 17 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
/node_modules/
/components/
/bower_components/
/test_scopes/angular_1.2.x/bower_components/
/test_scopes/angular_1.3.x/bower_components/
/dist/
/demo/js/angular-translate-latest.js

# OS X
.DS_Store
node_modules
components
bower_components
dist
demo/js/angular-translate-latest.js
.idea

# IntelliJ stuff
/.idea/
*.iml
atlassian-ide-plugin.xml
# Eclipse (plugins)
/atlassian-ide-plugin.xml

# Auto-added patterns

23 changes: 23 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/bower_components/
/demo/
/docs/
/identity/
/src/
/test/
/test_scopes/
/.bowerrc
/.editorconfig
/.jshintrc
/.travis.yml
/bower.json
/CONTRIBUTING.md
/*.sh
/*.js
/*.png
/update-docs

# IntelliJ stuff
.idea
*.iml
# Eclipse (plugins)
/atlassian-ide-plugin.xml
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ node_js:
- "0.10"

before_install:
- npm install -g grunt-cli karma-cli
- npm install -qg grunt-cli karma-cli

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

env:
- TEST_SCOPE=
- TEST_SCOPE=angular_1.2.x
- TEST_SCOPE=angular_1.3.x
54 changes: 52 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
var fs = require('fs');

module.exports = function (grunt) {

require('load-grunt-tasks')(grunt);

// Returns configuration for bower-install plugin
var loadTestScopeConfigurations = function () {
var scopes = fs.readdirSync('./test_scopes').filter(function (filename) {
return filename[0] !== '.';
});
var config = {
options : {
color : false,
interactive : false
}
};
// Create a sub config for each test scope
for (var idx in scopes) {
var scope = scopes[idx];
config['test_scopes_' + scope] = {
options : {
cwd : 'test_scopes/' + scope,
production : false
}
};
}
return config;
};

grunt.initConfig({

pkg: grunt.file.readJSON('bower.json'),
Expand Down Expand Up @@ -498,23 +524,46 @@ module.exports = function (grunt) {
src: ['docs/content/guide/<%= language %>/*.ngdoc'],
title: 'Guide'
}
}
},

version: {
options: {
prefix: 'var version\\s+=\\s+[\'"]'
},
defaults: {
src: ['<%= concat.core.dest %>']
}
},

'bower-install-simple': loadTestScopeConfigurations()

});




grunt.registerTask('default', ['jshint:all', 'karma']);
grunt.registerTask('test', ['karma:unit', 'karma:midway']);
grunt.registerTask('install-test', ['bower-install-simple']);

// Advanced test tasks
grunt.registerTask('test-headless', ['karma:headless-unit', 'karma:headless-midway']);
grunt.registerTask('test-browser-firefox', ['karma:browser-firefox-unit', 'karma:browser-firefox-midway']);
grunt.registerTask('test-all', ['karma']);
grunt.registerTask('test-all', ['test', 'test-headless', 'test-browser-firefox']);

grunt.registerTask('prepare-release', [
'jshint:all',
'test-headless',
'build-all'
]);

grunt.registerTask('build', [
'jshint:all',
'karma',
'build-all'
]);

grunt.registerTask('build-all', [
'build:core',
'build:messageformat_interpolation',
'build:handler_log',
Expand All @@ -528,6 +577,7 @@ module.exports = function (grunt) {
grunt.registerTask('build:core', [
'jshint:core',
'concat:core',
'version',
'ngmin:core',
'concat:banner_core',
'uglify:core'
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Pascal Precht",
"name": "angular-translate",
"description": "A translation module for AngularJS",
"version": "2.3.0",
"version": "2.4.0",
"homepage": "http://github.com/PascalPrecht/angular-translate",
"ignore": [],
"repository": {
Expand Down
10 changes: 10 additions & 0 deletions docs/content/guide/de/03_using-translate-service.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ Dabei muss jedoch beachtet werden, dass der Service immer ein Objekt mit allen
Übersetzung (oder sogar alle) nicht übersetzt werden konnten. Eine mögliche
Fehlerbehandlung muss von Deiner Seite aus geschehen.

## angular-translate Versionsinformationen
Für einige Anwendungen mag es sinnvoll sein, die eingesetzte Version im "Über uns"-Bereich o.ä. anzuzeigen.
Damit dieses problemlos möglich ist, beinhaltet angular-translate eine Funktion, die sehr einfach verwendet werden
kann und die aktuelle Modulversion zurückgibt:

<pre>
$translate.versionInfo();
// returns e.g. "2.1.0"
</pre>

## Dinge die berücksichtigt werden sollten
Bitte beachte dass `$translate` Service kein Two-Way Data-Binding unterstützt.
`$translate` Service arbeitet asynchron, dass bedeteut aber nicht, dass er informiert
Expand Down
46 changes: 46 additions & 0 deletions docs/content/guide/de/12_asynchronous-loading.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,52 @@ Sprache zur Laufzeit mit `$translate.use()` wechselt. Für den Fall dass die Dat
asynchron geladen werden ändert sich nichts. `$translate.use()` überprüft ob die
angefragte Sprache vorhanden ist und wenn nicht, wird diese erst geladen.

## Konfiguration eines Loaders

Jedem Loader kann eine erweiterte Konfiguration `options` angegeben werden. Dies
gilt sowohl für den allgemeinen Konstructor `useLoader(name, options)` als auch
die Shortcut-Konstruktoren wie `useStaticFilesLoader(options)`:

<pre>
$translationProvider.useLoader('customLoader', {
settingA: 'foobar'
});
$translationProvider.useStaticFilesLoader({
$http: {
method: 'POST'
}
});
</pre>

Die Eigenschaft `$http` wird entsprechend durchgereicht. Nur das Attribut `cache` wird ggf. überschrieben
(siehe nächstes Kapitel).

## Benutzung eines Caches

Bei der Verwendung der Standard Loader kann man das Caching steuern. Weitere Informationen
über Caches finden sich in der
[offiziellen AngularJS Dokumentation](https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache).

Den Cache kann man sehr leicht mit folgender Konfiguration aktivieren:

<pre>
$translationProvider.useLoaderCache(true); // default ist false, also deaktiviert
</pre>

Falls Du bereits eine eigene Instanz konfiguriert hast, kannst Du diese auch direkt übergeben:

<pre>
$translationProvider.useLoaderCache(yourSpecialCacheService);
</pre>

Angular-Translate unterstützt auch das Lazy-Binding, so dass auch folgendes funktioniert:

<pre>
$translationProvider.useLoaderCache('yourSpecialCacheService');
</pre>

Die Instanz mit der ID `yourSpecialCacheService` wird erst bei Bedarf aus dem Kontext geladen.

## FOUC - Flash of untranslated content

Es gibt einen Nachteil wenn man Asynchrone Loader verwendet. Für keinen kurzen
Expand Down
10 changes: 10 additions & 0 deletions docs/content/guide/en/03_using-translate-service.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ However, the service will always return an object containing translations -- reg
a translation (or even all of them) has failed. When requesting multiple translations
in one request, it is up to you to deal with the result.

## angular-translate library version information
As it may be useful for some "About" information in your application, we provide you a convenience
function to display or use the installed library version information.

Just call it this way:
<pre>
$translate.versionInfo();
// returns e.g. "2.1.0"
</pre>

## Things to keep in mind
Please keep in mind that the usage of the `$translate` service doesn't provide a two-way
data binding default! `$translate` service works asynchronously, which means
Expand Down
48 changes: 48 additions & 0 deletions docs/content/guide/en/12_asynchronous-loading.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,54 @@ registered loader to get it down! Lazy loading at it best!
**Note**: Please notice that in case of using `partialLoader` you have to refresh
translation tables first!

## Configuration of a loader

Each loader can be applied a dedicated configuration `options`, both for the common constructor
`useLoader()`
Jedem Loader kann eine erweiterte Konfiguration angegeben werden. Dies gilt sowohl für
den allgemeinen Konstructor `useLoader(name, options)` als auch die Shortcut-Konstruktoren
wie `useStaticFilesLoader(options)`:

<pre>
$translationProvider.useLoader('customLoader', {
settingA: 'foobar'
});
$translationProvider.useStaticFilesLoader({
$http: {
method: 'POST'
}
});
</pre>

The property `$http` will be used internally in the loaders, except attribute `cache` could be
overridden (see next chapter)).

## Using a cache

In order to control the caching behavior of the existing loaders, you can use an
cache instance. See more details about this at the
[Official AngularJS Docs](https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache).

In order to enable a standard cache, you can use following shortcut:

<pre>
$translationProvider.useLoaderCache(true); // default is false which means disable
</pre>

If you have already an instance (i.e. advanced configuration), you can bind this:

<pre>
$translationProvider.useLoaderCache(yourSpecialCacheService);
</pre>

Angular-Translate also supports lazy binding for instances, so this will work, too:

<pre>
$translationProvider.useLoaderCache('yourSpecialCacheService');
</pre>

The instance named with ID `yourspecialCacheService` will be looked up on demand.

## FOUC - Flash of untranslated content

There's one drawback when using asynchronous loaders to get your translation data
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/en/21_migration-guide.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $translate('translationId').then(function(translation) {
```

If you still want to use the service in sync manner then use
`$translate.instant(langKey, translationId, interpolateParams)` method instead of direct service
`$translate.instant(translationId, interpolateParams, interpolationId)` method instead of direct service
call. But note that `instant` method doesn't wait until async loading is done. So, be careful using
it.

Expand Down
10 changes: 10 additions & 0 deletions docs/content/guide/fr/03_using-translate-service.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ Toutefois, le service renverra toujours un objet contenant les traductions - san
traduction (ou même toutes) a échoué. Lorsque vous demandez plusieurs traductions en une seule
requête, c'est à vous de traiter le résultat.

## Information de la version de la bibliothèque angular-translate
Il peut être utile d'avoir certaines informations dans votre application, nous vous fournissons une
fonction pour afficher ou utiliser les informations de la version de la bibliothèque installée.

Il suffit de l'appeler de cette façon :
<pre>
$translate.versionInfo();
// retourne par exemple "2.1.0"
</pre>

## Les choses à garder à l'esprit
Veuillez gardez à l'esprit que l'utilisation du service `$translate` n'assure pas une liaison de
données par défaut bidirectionnelle ! Le service `$translate` fonctionne de manière asynchrone, ce qui
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/fr/21_migration-guide.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $translate('translationId').then(function(translation) {
```

Si vous voulez continuer à utiliser le service de manière synchrone alors utilisez
la méthode `$translate.instant(langKey, translationId, interpolateParams)` au lieu de l'appel direct
la méthode `$translate.instant(translationId, interpolateParams, interpolationId)` au lieu de l'appel direct
du service. Mais notez que la méthode `instant` n'attend pas que le chargement asynchrone soit fait.
Alors, soyez prudent dans son utilisation.

Expand Down
10 changes: 10 additions & 0 deletions docs/content/guide/ru/03_using-translate-service.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ app.controller('Ctrl', ['$scope', '$translate', function ($scope, $translate) {
(или идентификаторы) не получилось. Запросив несколько переводов за один раз, вы должны сами
обработать полученный результат.

## Информация о версии библиотеки angular-translate
Мы предоставляем удобную функцию для получения информации о версии установленной библиотеки, так как
это может быть полезным для какого-нибудь раздела о вашем приложении.

Просто вызовите её вот так:
<pre>
$translate.versionInfo();
// returns e.g. "2.1.0"
</pre>

## Имейте ввиду
Пожалуйста, имейте ввиду, что сервис `$translate` по умолчанию не предоставляет двухстороннего
связывания данных! Сервис `$translate` работает асинхронно. Это значит, что он возвращает перевод
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/ru/21_migration-guide.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $translate('translationId').then(function(translation) {
```

Если вы все же хотите использовать сервис в синхронном стиле, используйте метод
`$translate.instant(langKey, translationId, interpolateParams)` вместо прямого вызова сервиса. Но
`$translate.instant(translationId, interpolateParams, interpolationId)` вместо прямого вызова сервиса. Но
заметьте, что метод `instant` не ждет завершения асинхронной загрузки. Поэтому, будьте осторожны при
его использовании.

Expand Down
10 changes: 10 additions & 0 deletions docs/content/guide/uk/03_using-translate-service.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ app.controller('Ctrl', ['$scope', '$translate', function ($scope, $translate) {
(або ідентифікатори) не вдалося. Запросивши кілька перекладів за один раз ви повинні самі обробити
отриманий результат.

## Інформація про версію бібліотеки angular-translate
Ми надаємо зручну функцію для отримання інформації про версію встановленої бібліотеки, адже це може
бути корисним для якого-небудь розділу про ваш застосунок.

Просто викличте її ось так:
<pre>
$translate.versionInfo();
// returns e.g. "2.1.0"
</pre>

## Майте на увазі

Будь ласка, майте на увазі, що сервіс `$translate` за замовчуванням не надає двостороннього
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/uk/21_migration-guide.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $translate('translationId').then(function(translation) {
```

Якщо ви, все ж таки, хочете використовувати сервіс у синхронному стилі, використовуйте метод
`$translate.instant(langKey, translationId, interpolateParams)` замість прямого виклику сервісу. Але
`$translate.instant(translationId, interpolateParams, interpolationId)` замість прямого виклику сервісу. Але
майте на увазі, що метод `instant` не чекає завершення асинхронного завантаження. Тому, будьте
обережні при його використанні.

Expand Down
Loading

0 comments on commit 7ac5be0

Please sign in to comment.