Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document options #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 67 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,82 @@ Used to construct build tools for [`angular-gettext`](https://github.com/rubenv/

[![Build Status](https://travis-ci.org/rubenv/grunt-angular-gettext.png?branch=master)](https://travis-ci.org/rubenv/angular-gettext-tools)

Implementations:
## Usage

You probably want to use one of the build plugins that wrap this library
instead. Current implementations:

* [Grunt plugin](https://github.com/rubenv/grunt-angular-gettext)
* [Gulp plugin](https://github.com/gabegorelick/gulp-angular-gettext)

Check the website for usage instructions: [http://angular-gettext.rocketeer.be/](http://angular-gettext.rocketeer.be/).
## API

`angular-gettext-tools` has two components: an `Extractor` for extracting
translatable strings into a [POT file](http://www.icanlocalize.com/site/tutorials/how-to-translate-with-gettext-po-and-pot-files),
and a `Compiler` for converting [PO files](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html)
into a format that the runtime library ([angular-gettext](https://github.com/rubenv/angular-gettext))
can consume.

For more information, check out the [official website](https://angular-gettext.rocketeer.be).

### `Extractor` options

All `Extractor` options are optional.

#### `startDelim`
Delimiter that starts your Angular expressions. If you're using
[custom delimiters](https://docs.angularjs.org/api/ng/provider/$interpolateProvider)
for your Angular expressions, you should set the the `Extractor` can parse your
expressions. Defaults to `{{`, which is Angular's default.

#### `endDelim`
Delimiter that ends your Angular expressions. Defaults to `}}`, which is
Angular's default.

#### `markerName`
String to use as marker when parsing JavaScript for extractable strings.
Defaults to `gettext`.

#### `markerNames`
Array of additional markers. If you're using a custom service that wraps
`angular-gettext`, you'll probably want to pass the name of your service here
so `angular-gettext-tools` can extract your strings.

#### `lineNumbers`
`false` to disable outputting line numbers in PO file references. Defaults to
`true`.

#### `extensions`
Object mapping file extensions to extraction strategies. Valid
strategies are `html` or `js`. For example, if you have a file `foo.bar` you
want parsed as HTML, pass `{extensions: {foo: 'html'}}` to the `Extractor`.

#### `postProcess`
Callback to post process the resulting PO file. Passed a
[`pofile`](https://www.npmjs.com/package/pofile) object.

### `Compiler` options

All `Compiler` options are optional.

#### `format`
Output format. `javascript` or `json`. Defaults to `javascript` for ease of use,
but for more control over how strings are loaded into your app, consider using
`json` and then generating your own JavaScript to suit your needs.

#### `module`
Name of the Angular module to output. Only used if `format` is `javascript`.
Defaults to `gettext`.

#### `requirejs`
Whether to wrap the output in a [RequireJS](http://requirejs.org) module. Only
used if `format` is `javascript`. Defaults to false.

## License

(The MIT License)

Copyright (C) 2013-2014 by Ruben Vermeersch <[email protected]>
Copyright (C) 2013-2015 by Ruben Vermeersch <[email protected]>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add a line here with your details, given the amount of contributions it's only fair to do so :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to like Copyright (c) 2013-2015 by angular-gettext-tools contributors, especially since there's no copyright assignment, which means individual contributors maintain full rights.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this was automatically updated by my editor :-)


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down