Skip to main content

An AngularJS extractor for Babel

Project description

pybabel-angularjs
=================

[![Build Status](https://travis-ci.org/chuckyblack/pybabel-angularjs.svg?branch=master)](https://travis-ci.org/chuckyblack/pybabel-angularjs.svg?branch=master)

A Babel extractor for AngularJS templates.

To translate the content of an HTML element use the `i18n`
attribute:

<div i18n>hello world!</div>

To give somme context to your translators add value to the attribute:

<div i18n="page title">hello world!</div>

## Babel configuration

### extract_attribute

To change default `i18n` attribute use `extract_attribute` options:

[angularjs: **/*.html]
encoding = utf-8
extract_attribute = translate

Then use in template:

<div translate="page title">hello world!</div>

### include_attributes

To translate attributes of HTML nodes use `include_attributes` options:

[angularjs: **/*.html]
encoding = utf-8
include_attributes = title, alt

Then use in template:

<div title="some title">hello world!</div>
<img src="..." alt="some image description">


### allowed_tags

Content of every translated tag is checked for tags it contains. You have to define sub-tags that can occur.
Tags allowed by default are: strong, br, i

[angularjs: **/*.html]
encoding = utf-8
allowed_tags = a, strong, br


### allowed_attributes_x

Sub-tags (described in 'allowed_tags') may by default contain NO attributes at all.
If you want to enable them to, you have to use this notation:

[angularjs: **/*.html]
encoding = utf-8
allowed_tags = a, i
allowed_attributes_a = href
allowed_attributes_i = class

The allowed_attribues_x setting needs to be accompanied by appropriate 'allowed_tags' setting.


Heavily inspired by
https://bitbucket.org/shoreware/pybabel-angularjs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybabel-angularjs-1.3.5.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file pybabel-angularjs-1.3.5.tar.gz.

File metadata

  • Download URL: pybabel-angularjs-1.3.5.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.14

File hashes

Hashes for pybabel-angularjs-1.3.5.tar.gz
Algorithm Hash digest
SHA256 a290a810df7a0c72aa76296e6564bc401342926fb35890d2fa3b0f667417e871
MD5 d18011438e1f5358a269a604a1334b70
BLAKE2b-256 6c256159abe989f630503879876e55167653ce45226eed5dbfcbebb46e23970f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page