Skip to content

Commit 2ce669e

Browse files
authored
let there be colour
1 parent 0048b22 commit 2ce669e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Pluralize is a Python library for Internationalization (i18n) and Pluralization.
44

55
The library assumes a folder (for exaple "translations") that contains files like:
66

7-
```
7+
```sh
88
it.json
99
it-IT.json
1010
fr.json
@@ -14,7 +14,7 @@ fr-FR.json
1414

1515
Each file has the following structure, for example for Italian (it.json):
1616

17-
```
17+
```json
1818
{"dog": {"0": "no cane", "1": "un cane", "2": "{n} cani", "10": "tantissimi cani"}}
1919
```
2020

@@ -23,13 +23,13 @@ Different translations correspond to different plural forms of the expression,
2323

2424
Here is another example for the word "bed" in Czech
2525

26-
```
26+
```json
2727
{"bed": {"0": "no postel", "1": "postel", "2": "postele", "5": "postelí"}}
2828
```
2929

3030
To translate and pluralize a string "dog" one simply wraps the string in the T operator as follows:
3131

32-
```
32+
```python
3333
>>> from pluralize import Translator
3434
>>> T = Translator('translations')
3535
>>> dog = T("dog")
@@ -58,23 +58,23 @@ T.select(s) can parse a string s following the HTTP accept language format.
5858
## Update the translation files
5959

6060
Find all strings wrapped in T(...) in .py, .html, and .js files:
61-
```
61+
```python
6262
matches = T.find_matches('path/to/app/folder')
6363
```
6464

6565
Add newly discovered entries in all supported languages
66-
```
66+
```python
6767
T.update_languages(matches)
6868
```
6969

7070
Add a new supported language (for example german, "de")
7171

72-
```
72+
```python
7373
T.languages['de'] = {}
7474
```
7575

7676
Make sure all languages contain the same origin expressions
77-
```
77+
```python
7878
known_expressions = set()
7979
for language in T.languages.values():
8080
for expression in language:
@@ -84,6 +84,6 @@ T.update_languages(known_expressions))
8484

8585
Finally save the changes:
8686

87-
```
87+
```python
8888
T.save('translations')
8989
```

0 commit comments

Comments
 (0)