Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elm-fluent/elm-fluent
Browse files Browse the repository at this point in the history
  • Loading branch information
spookylukey committed Apr 9, 2020
2 parents 0aec266 + 44bb957 commit 777477b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 21 deletions.
49 changes: 30 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ elm-fluent
==========


.. image:: https://img.shields.io/pypi/v/elm_fluent.svg
:target: https://pypi.org/project/elm-fluent/
.. image:: https://badge.fury.io/py/elm-fluent.svg
:target: https://badge.fury.io/py/elm-fluentt/

.. image:: https://travis-ci.org/elm-fluent/elm-fluent.svg?branch=master
:target: https://travis-ci.org/elm-fluent/elm-fluent
Expand All @@ -17,19 +17,31 @@ elm-fluent
:alt: Documentation Status


elm-fluent is a `Fluent <https://projectfluent.org/>`_ implementation for Elm.

Fluent is a next-generation translation/localization solution, designed by the
folks at Mozilla, based on many years of experience with localizing into a large
number of different languages. Mozilla have extracted parts of their 'l20n'
solution (used by apps like Firefox and Thunderbird) into a re-usable
specification designed specifically for the web.

elm-fluent is a full implementation of this specification for Elm (see the
`change log <https://elm-fluent.readthedocs.io/en/latest/history.html>`_ for exact
version support).
elm-fluent is an internationalization/localization solution for Elm.

It features:

- A full implementation of `Fluent - Mozilla's brilliant next generation translation/internationalization/localization system <https://projectfluent.org/>`_.
- A compiler approach that means you get excellent performance.
- Proper support for the classic 'plurals' problem in i18n, along with other i18n issues.
- Compile-time checking of every possible syntax or type error in your Fluent FTL files, by leveraging
both Elm's type system and our own checks.
- Built-in ability to format numbers and dates according to locale, with ability to customize.
This means **strongly-typed messages and substitutions** that help you avoid i18n issues
you might not even know exist.
- An elegant solution for the thorny problem of internationalizing messages that contain
HTML fragments (such as bold text and hyperlinks), while also allowing such
elements to work as normal in Elm's event model (e.g. clickable links that send
Elm messages).
- Excellent, explicit compile-time error messages - inspired by the Elm compiler.

It combines the power of Fluent with Elm's you-just-cant-break-it safety to give
a very capable i18n solution.

Oveview
-------

It operates as a command line tool that compiles ``.ftl`` files to ``.elm``
elm-fluent operates as a command line tool that compiles ``.ftl`` files to ``.elm``
files. The result is that each message becomes a function that will generate a
translated string (or HTML fragment) for a given locale and an optional set of
strongly typed parameters (string, dates or numbers).
Expand All @@ -48,11 +60,10 @@ Discourse Fluent category <https://discourse.mozilla.org/c/fluent>`_.
Status
------

* Rough around the edges, but being used in production. Please see the list of `open issues
<https://github.com/elm-fluent/elm-fluent/issues>`_.
* A pretty complete test suite, and sufficient docs.
* Good attention to usability in terms of nice error messages.
* Compatibility: Elm 0.18 only.
* Stable - used in production.
* A few rough edges - please see the list of `open issues <https://github.com/elm-fluent/elm-fluent/issues>`_.
* A pretty complete test suite, and a nice set of docs.
* **Compatibility: Elm 0.18 only**.

Elm 0.19 is problematic - we require a wrapper for `Intl
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl>`_,
Expand Down
3 changes: 2 additions & 1 deletion src/elm_fluent/codegen.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Utilities for doing Python code generation
Utilities for doing Elm code generation.
Type signatures are handled by types.py
"""
import contextlib
import re
Expand Down
4 changes: 3 additions & 1 deletion src/elm_fluent/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,9 @@ def combine_arg_types_master(locale_message_arg_types, message_id):
"""
errors = []
combined = defaultdict(list)
for locale, messages_arg_types in locale_message_arg_types.items():
locales = sorted(locale_message_arg_types.keys())
for locale in locales:
messages_arg_types = locale_message_arg_types[locale]
if message_id not in messages_arg_types:
continue
arg_types = messages_arg_types[message_id] # {arg_name: arg_type}
Expand Down

0 comments on commit 777477b

Please sign in to comment.