Skip to content

Commit

Permalink
Fixed license + credits
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Jul 31, 2011
1 parent 34693b5 commit 7200c69
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 22 deletions.
4 changes: 3 additions & 1 deletion README.markdown
Expand Up @@ -239,4 +239,6 @@ bazinga_expose_translation:

## Credits

* William DURAND (Bazinga).
* William DURAND (Bazinga) as main author.
* Jan Sorgalla as contributor.
* Stan Chollet as contributor.
44 changes: 23 additions & 21 deletions Resources/doc/README.markdown
Expand Up @@ -48,7 +48,7 @@ Register the routing in `app/config/routing.yml`:
``` yaml
# app/config/routing.yml
_bazinga_exposetranslation:
resource: "@BazingaExposeTranslationBundle/Resources/config/routing/routing.xml"
resource: "@BazingaExposeTranslationBundle/Resources/config/routing/routing.yml"
```

Publish assets:
Expand Down Expand Up @@ -102,10 +102,10 @@ This will provide translated messages found in each `DOMAIN_NAME.MY_LOCALE.*` fi
It's quite simple:

``` javascript
$.ExposeTranslation.has('DOMAIN_NAME:key');
ExposeTranslation.has('DOMAIN_NAME:key');
// true or false

$.ExposeTranslation.get('DOMAIN_NAME:key');
ExposeTranslation.get('DOMAIN_NAME:key');
// the translated message or undefined
```

Expand All @@ -115,7 +115,7 @@ If you don't specify any **domain**, a guesser is provided to find the best tran
To configure the guesser, you have to set the `defaultDomains` attribute. By default, the configured default domain is `messages`.

``` javascript
$.ExposeTranslation.get('key');
ExposeTranslation.get('key');
// will try to find a translated message in default domains.
```

Expand All @@ -128,7 +128,7 @@ Read the official documentation about Symfony2 [message placeholders](http://sym
The `get()` method accepts a second argument that takes placeholders without `%` delimiters:

``` javascript
$.ExposeTranslation.get('DOMAIN_NAME:key', { "foo" : "bar" });
ExposeTranslation.get('DOMAIN_NAME:key', { "foo" : "bar" });
// will replace each "%foo%" in the message by "bar".
```

Expand All @@ -148,27 +148,27 @@ apples: "{0} There is no apples|{1} There is one apple|]1,19] There are %count%
```

``` javascript
$.ExposeTranslation.locale = 'en';
ExposeTranslation.locale = 'en';

$.ExposeTranslation.get('apples', {"count" : 0}, 0);
ExposeTranslation.get('apples', {"count" : 0}, 0);
// will return "There is no apples"

$.ExposeTranslation.get('apples', {"count" : 1}, 1);
ExposeTranslation.get('apples', {"count" : 1}, 1);
// will return "There is one apple"

$.ExposeTranslation.get('apples', {"count" : 2}, 2);
ExposeTranslation.get('apples', {"count" : 2}, 2);
// will return "There are 2 apples"

$.ExposeTranslation.get('apples', {"count" : 10}, 10);
ExposeTranslationExposeTranslation.get('apples', {"count" : 10}, 10);
// will return "There are 10 apples"

$.ExposeTranslation.get('apples', {"count" : 19}, 19);
ExposeTranslation.get('apples', {"count" : 19}, 19);
// will return "There are 19 apples"

$.ExposeTranslation.get('apples', {"count" : 20}, 20);
ExposeTranslation.get('apples', {"count" : 20}, 20);
// will return "There are many apples"

$.ExposeTranslation.get('apples', {"count" : 100}, 100);
ExposeTranslation.get('apples', {"count" : 100}, 100);
// will return "There are many apples"
```

Expand All @@ -179,7 +179,7 @@ $.ExposeTranslation.get('apples', {"count" : 100}, 100);
You can get the current locale by accessing the `locale` attribute:

``` javascript
$.ExposeTranslation.locale;
ExposeTranslation.locale;
// will return the current locale.
```

Expand All @@ -205,22 +205,22 @@ placeholder: "Hello %username%, how are you ?"
You can do:

``` javascript
$.ExposeTranslation.get('Hello:foo');
ExposeTranslation.get('Hello:foo');
// will return 'Bar' if the current locale is set to 'fr', undefined otherwise.

$.ExposeTranslation.get('Hello:ba.bar');
ExposeTranslation.get('Hello:ba.bar');
// will return 'Hello world' if the current locale is set to 'fr', undefined otherwise.

$.ExposeTranslation.get('Hello:placeholder');
ExposeTranslation.get('Hello:placeholder');
// will return 'Hello %username% !' if the current locale is set to 'fr', undefined otherwise.

$.ExposeTranslation.get('Hello:placeholder', { "username" : "will" });
ExposeTranslation.get('Hello:placeholder', { "username" : "will" });
// will return 'Hello will !' if the current locale is set to 'fr', undefined otherwise.

$.ExposeTranslation.get('placeholder', { "username" : "will" });
ExposeTranslation.get('placeholder', { "username" : "will" });
// will return 'Hello will, how are you ?' if the current locale is set to 'fr', undefined otherwise.

$.ExposeTranslation.get('placeholder');
ExposeTranslation.get('placeholder');
// will return 'Hello %username%, how are you ?' if the current locale is set to 'fr', undefined otherwise.
```

Expand All @@ -239,4 +239,6 @@ bazinga_expose_translation:

## Credits

* William DURAND (Bazinga).
* William DURAND (Bazinga) as main author.
* Jan Sorgalla as contributor.
* Stan Chollet as contributor.
19 changes: 19 additions & 0 deletions Resources/meta/LICENSE
@@ -0,0 +1,19 @@
Copyright (c) 2011 William Durand <william.durand1@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

0 comments on commit 7200c69

Please sign in to comment.