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

Documentation #15

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
26 changes: 26 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,29 @@ from tcii18n import Translator
translator = Translator('my_file.csv')
translator.translate('My string')
```

In a flask project:

*core.py*

```
from tcii18n.template import flask_methods

def get_translations_file():
return 'path/to/my/file.csv'

flask_methods(app, get_translations_file)
```

*template.html*

```
<h1>{{ _("Sentence") }}</h1>
```

Where:

-get_translations_file() is a function that returns the appropriate translation file path
Copy link
Member

Choose a reason for hiding this comment

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

-get_translations_file() > add a space after "-" and use backticks ` for showing it as code.

-flask_methods(app, get_translation_file) initializes the template processor
Copy link
Member

Choose a reason for hiding this comment

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

same here

with app as your Flask instance and get_translation_file is the reference
Copy link
Member

Choose a reason for hiding this comment

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

same here for get_translation_file

to the callable method.