File tree Expand file tree Collapse file tree 14 files changed +201
-89
lines changed Expand file tree Collapse file tree 14 files changed +201
-89
lines changed Original file line number Diff line number Diff line change 11.tox
2+ .vscode
23* .pyc
34.eggs /
45* .egg-info /
56_build
7+ build
8+ dist
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ Project Fluent
2+ ==============
3+
4+ This is a collection of Python packages to use the `Fluent localization
5+ system <http://projectfluent.org/> `__.
6+
7+ python-fluent consists of these packages:
8+
9+ ``fluent.syntax ``
10+ -----------------
11+
12+ The `syntax package <fluent.syntax >`_ includes the parser, serializer, and traversal
13+ utilities like Visitor and Transformer. You’re looking for this package
14+ if you work on tooling for Fluent in Python.
15+
16+ ``fluent.runtime ``
17+ ------------------
18+
19+ The `runtime package <fluent.runtime >`__ includes the library required to use Fluent to localize
20+ your Python application. It comes with a ``Localization `` class to use,
21+ based on an implementation of ``FluentBundle ``. It uses the tooling parser above
22+ to read Fluent files.
23+
24+ ``fluent.pygments ``
25+ -------------------
26+
27+ A `plugin for pygments <fluent.pygments >`_ to add syntax highlighting to Sphinx.
28+
29+ Discuss
30+ -------
31+
32+ We’d love to hear your thoughts on Project Fluent! Whether you’re a
33+ localizer looking for a better way to express yourself in your language,
34+ or a developer trying to make your app localizable and multilingual, or
35+ a hacker looking for a project to contribute to, please do get in touch
36+ on the mailing list and the IRC channel.
37+
38+ - Mozilla Discourse: https://discourse.mozilla.org/c/fluent
39+ - Matrix channel:
40+ `#fluent:mozilla.org <https://chat.mozilla.org/#/room/#fluent:mozilla.org >`__
41+
42+ Get Involved
43+ ------------
44+
45+ python-fluent is open-source, licensed under the Apache License, Version
46+ 2.0. We encourage everyone to take a look at our code and we’ll listen
47+ to your feedback.
Original file line number Diff line number Diff line change @@ -5,24 +5,31 @@ python-fluent
55The :py:mod: `python-fluent ` project contains several packages to
66bring `Project Fluent <https://projectfluent.org >`__ to Python.
77Visit the `Github project <https://github.com/projectfluent/python-fluent >`__
8- for the full list. Two packages in particular are of general interest
8+ for the full list. Three packages in particular are of general interest
99and documented here.
1010
1111fluent.syntax
1212-------------
1313
14- ``fluent- syntax `` is the package to use for tooling, analysis, and
14+ ``fluent. syntax `` is the package to use for tooling, analysis, and
1515processing of Fluent files.
1616
1717fluent.runtime
1818--------------
1919
20- ``fluent- runtime `` is the reference runtime implementation for
20+ ``fluent. runtime `` is the reference runtime implementation for
2121Fluent in Python.
2222
23+ fluent.pygments
24+ ---------------
25+
26+ ``fluent.pygments `` can be used to add syntax highlighting for
27+ Fluent files to Sphinx documentation.
28+
2329.. toctree ::
2430 :caption: Packages
2531 :maxdepth: 1
2632
2733 fluent.syntax <https://projectfluent.org/python-fluent/fluent.syntax/ >
2834 fluent.runtime <https://projectfluent.org/python-fluent/fluent.runtime/ >
35+ fluent.pygments <https://projectfluent.org/python-fluent/fluent.pygments/ >
Original file line number Diff line number Diff line change 1+ fluent.pygments
2+ ===============
3+
4+ A plugin for pygments to add `Fluent `_ syntax highlighting to Sphinx.
5+
6+ Installation
7+ ------------
8+
9+ .. code-block :: bash
10+
11+ pip install fluent.pygments
12+
13+
14+ Usage
15+ -----
16+
17+ .. code-block :: rst
18+
19+
20+ .. code-block:: fluent
21+
22+ my-message = a localized string
23+
24+
25+ The `documentation `_ has an example of Fluent content
26+ highlighted with ``fluent.pygments ``.
27+
28+ .. _fluent : https://projectfluent.org/
29+ .. _documentation : https://projectfluent.org/python-fluent/fluent.pygments
Original file line number Diff line number Diff line change 1+ Fluent Syntax Highlighting
2+ ==========================
3+
4+ The :py:mod: `fluent.pygments ` library is built to do syntax highlighting
5+ for `Fluent `_ files in Sphinx.
6+
7+
8+ Installation
9+ ------------
10+
11+ .. code-block :: bash
12+
13+ pip install fluent.pygments
14+
15+
16+ Usage
17+ -----
18+
19+ .. code-block :: rst
20+
21+
22+ .. code-block:: fluent
23+
24+ my-key = Localize { -brand-name }
25+
26+ Example
27+ -------
28+
29+ .. code-block :: fluent
30+
31+ ### A resource comment for the whole file
32+
33+ my-key = Localize { -brand-name }
34+ -brand-name = Fluent
35+
36+ # $num is the number of strings to localize
37+ plurals = { $num ->
38+ [one] One string
39+ *[other] {$num} strings
40+ }
41+ an error ;-)
42+ Most-strings = are just simple strings.
43+
44+ .. _fluent : https://projectfluent.org/
Original file line number Diff line number Diff line change 1+ [metadata]
2+ version =0.1.0
3+
14[bdist_wheel]
25universal =1
36
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22from setuptools import setup
3+ import os
4+
5+ this_directory = os .path .abspath (os .path .dirname (__file__ ))
6+ with open (os .path .join (this_directory , 'README.rst' ), 'rb' ) as f :
7+ long_description = f .read ().decode ('utf-8' )
38
49setup (name = 'fluent.pygments' ,
5- version = '0.1.0' ,
610 description = 'Pygments lexer for Fluent.' ,
7- long_description = 'See https://github.com/projectfluent/python-fluent/ for more info.' ,
11+ long_description = long_description ,
12+ long_description_content_type = 'text/x-rst' ,
813 author = 'Mozilla' ,
914 author_email = 'l10n-drivers@mozilla.org' ,
1015 license = 'APL 2' ,
2025 packages = ['fluent' , 'fluent.pygments' ],
2126 tests_require = ['six' ],
2227 test_suite = 'tests.pygments'
23- )
28+ )
Original file line number Diff line number Diff line change 1+ fluent.runtime |fluent.runtime |
2+ ===============================
3+
4+ Use `Fluent `_ to localize your Python application. It comes with a ``Localization ``
5+ class to use, based on an implementation of ``FluentBundle ``. It uses the parser from
6+ ``fluent.syntax `` to read Fluent files.
7+
8+ .. code-block :: python
9+
10+ >> > from datetime import date
11+ >> > l10n = DemoLocalization(" today-is = Today is { $today }" )
12+ >> > val = l10n.format_value(" today-is" , {" today" : date.today() })
13+ >> > val
14+ ' Today is Jun 16, 2018'
15+
16+ Find the full documentation on https://projectfluent.org/python-fluent/fluent.runtime/.
17+
18+ .. _fluent : https://projectfluent.org/
19+ .. |fluent.runtime | image :: https://github.com/projectfluent/python-fluent/workflows/fluent.runtime/badge.svg
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ passed through locale aware functions:
153153
154154 >> > from datetime import date
155155 >> > l10n = DemoLocalization(" today-is = Today is { $today }" )
156- >> > val = bundle .format_value(" today-is" , {" today" : date.today() })
156+ >> > val = l10n .format_value(" today-is" , {" today" : date.today() })
157157 >> > val
158158 ' Today is Jun 16, 2018'
159159
You can’t perform that action at this time.
0 commit comments