Skip to content

Commit

Permalink
Update tooling and UI development documentation to cover I18N
Browse files Browse the repository at this point in the history
- Document steps for adding I18N in builds
- Add "clean-language" target to remove *.mo files

Signed-off-by: Hideki Saito <[email protected]>
  • Loading branch information
saito-hideki authored and jakemcdermott committed Jul 31, 2019
1 parent 94e14ae commit 8362aa7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ Run the following to build the AWX UI:
```bash
(host) $ make ui-devel
```
See [the ui development documentation](awx/ui/README.md) for more information on using the frontend development, build, and test tooling.

### Running the environment

#### Start the containers
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ I18N_FLAG_FILE = .i18n_built
ui-test ui-deps ui-test-ci VERSION

# remove ui build artifacts
clean-ui:
clean-ui: clean-languages
rm -rf awx/ui/static/
rm -rf awx/ui/node_modules/
rm -rf awx/ui/test/unit/reports/
Expand Down Expand Up @@ -94,6 +94,10 @@ clean-schema:
rm -rf schema.json
rm -rf reference-schema.json

clean-languages:
rm -f $(I18N_FLAG_FILE)
find . -type f -regex ".*\.mo$$" -delete

# Remove temporary build files, compiled Python files.
clean: clean-ui clean-dist
rm -rf awx/public
Expand Down
20 changes: 20 additions & 0 deletions awx/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ npm --prefix awx/ui run e2e
```shell
# add an exact development or build dependency
npm install --prefix awx/ui --save-dev --save-exact [email protected]

# add an exact production dependency
npm install --prefix awx/ui --save --save-exact [email protected]

Expand All @@ -81,3 +82,22 @@ npm uninstall --prefix awx/ui --save prod-package
# built files are placed in awx/ui/static
make ui-release
```

## Internationalization
Application strings marked for translation are extracted and used to generate `.pot` files using the following command:
```shell
# extract strings and generate .pot files
make pot
```
To include the translations in the development environment, we compile them prior to building the ui:
```shell
# remove any prior ui builds
make clean-ui

# compile the .pot files to javascript files usable by the application
make languages

# build the ui with translations included
make ui-devel
```
**Note**: Python 3.6 is required to compile the `.pot` files.

0 comments on commit 8362aa7

Please sign in to comment.