зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1574411, use fluent.pygments to syntax-highlight code blocks, r=ahal,flod
Differential Revision: https://phabricator.services.mozilla.com/D42277 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4b3c5c8fa3
Коммит
d638afbb1b
|
@ -220,7 +220,7 @@ placeholders or entities that need to be replaced to adapt to Fluent syntax.
|
|||
Consider for example the following string:
|
||||
|
||||
|
||||
.. code-block:: XML
|
||||
.. code-block:: DTD
|
||||
|
||||
<!ENTITY aboutSupport.featuresTitle "&brandShortName; Features">
|
||||
|
||||
|
@ -228,7 +228,7 @@ Consider for example the following string:
|
|||
Which needs to be migrated to:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
features-title = { -brand-short-name } Features
|
||||
|
||||
|
@ -302,7 +302,7 @@ variables, implicitly relying on the order in which the arguments appear:
|
|||
And the target Fluent string:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
update-full-name = { $name } ({ $buildID })
|
||||
|
||||
|
@ -373,7 +373,7 @@ string is displayed in products, and are added only for formatting reasons. For
|
|||
example, consider this string:
|
||||
|
||||
|
||||
.. code-block:: XML
|
||||
.. code-block:: DTD
|
||||
|
||||
<!ENTITY aboutAbout.note "This is a list of “about” pages for your convenience.<br/>
|
||||
Some of them might be confusing. Some are for diagnostic purposes only.<br/>
|
||||
|
@ -383,7 +383,7 @@ example, consider this string:
|
|||
If migrated as is, it would result in:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
about-about-note =
|
||||
This is a list of “about” pages for your convenience.<br/>
|
||||
|
@ -395,7 +395,7 @@ This can be avoided by trimming the migrated string, with :python:`trim:"True`
|
|||
or :python:`trim=True`, depending on the context:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: python
|
||||
|
||||
transforms_from(
|
||||
"""
|
||||
|
@ -452,9 +452,9 @@ Consider the following example:
|
|||
In Fluent:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
searchResults.needHelpSupportLink = Need help? Visit <a data-l10n-name="url">{ -brand-short-name } Support</a>
|
||||
search-results-need-help-support-link = Need help? Visit <a data-l10n-name="url">{ -brand-short-name } Support</a>
|
||||
|
||||
|
||||
This is quite a complex migration: it requires to take 2 legacy strings, and
|
||||
|
@ -523,7 +523,7 @@ Consider the following legacy string:
|
|||
In Fluent:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
containers-disable-alert-ok-button =
|
||||
{ $tabCount ->
|
||||
|
@ -570,7 +570,7 @@ It’s always possible to migrate strings by manually creating the underlying AS
|
|||
structure. Consider the following complex Fluent string:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
use-current-pages =
|
||||
.label =
|
||||
|
|
|
@ -53,7 +53,7 @@ comment explaining the format of the variable, and what kind of content it will
|
|||
be replaced with. This is the format suggested for such comments:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
# This string is used on a new line below the add-on name
|
||||
# Variables:
|
||||
|
@ -127,7 +127,7 @@ Message References
|
|||
Consider the following example:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
newtab-search-box-search-the-web-text = Search the Web
|
||||
newtab-search-box-search-the-web-input =
|
||||
|
@ -146,7 +146,7 @@ On the other hand, this approach is helpful if, for example, you want to
|
|||
reference another element of the UI in your message:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
help-button = Help
|
||||
help-explanation = Click the { help-button} to access support
|
||||
|
@ -176,7 +176,7 @@ Variants and plurals
|
|||
Consider the following example:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
items-selected =
|
||||
{ $num ->
|
||||
|
@ -191,7 +191,7 @@ variant covered, since variants are private by design. The correct approach for
|
|||
the example would be to have a separate message for the :js:`0` case:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
# Separate messages which serve different purposes.
|
||||
items-select = Select items
|
||||
|
@ -217,7 +217,7 @@ In general, also avoid putting a selector in the middle of a sentence, like in
|
|||
the example below:
|
||||
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
items-selected =
|
||||
{ $num ->
|
||||
|
|
|
@ -115,7 +115,7 @@ and localization features offered by the system.
|
|||
|
||||
At first glance the format resembles `.properties` file. It may look like this:
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
home-page-header = Home Page
|
||||
|
||||
|
@ -127,7 +127,7 @@ quickly add up. In order to familiarize yourself with the basic features,
|
|||
consider reading through the `Fluent Syntax Guide`_ to understand
|
||||
a more complex example like:
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
### These messages correspond to security and privacy user interface.
|
||||
###
|
||||
|
@ -243,7 +243,7 @@ The other change is that the developer can localize a whole fragment of DOM:
|
|||
</span>
|
||||
</p>
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
-brand-short-name = Firefox
|
||||
update-application-info =
|
||||
|
@ -402,7 +402,7 @@ an external argument number:
|
|||
Localizers can use the argument to build a multi variant message if their
|
||||
language requires that:
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
unread-warning =
|
||||
{ $unreadCount ->
|
||||
|
@ -416,7 +416,7 @@ its `plural category`__ should be retrieved.
|
|||
If the given translation doesn't need pluralization for the string (for example
|
||||
Japanese often will not), the localizer can replace it with:
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
unread-warning = You have { $unreadCount } unread messages
|
||||
|
||||
|
@ -425,7 +425,7 @@ and the message will preserve the social contract.
|
|||
One additional feature is that the localizer can further improve the message by
|
||||
specifying variants for particular values:
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
unread-warning =
|
||||
{ $unreadCount ->
|
||||
|
@ -471,7 +471,7 @@ representation of the date in string:
|
|||
})
|
||||
});
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
welcome-message = Your session will start date: { $startDate }
|
||||
|
||||
|
@ -481,7 +481,7 @@ Firefox as `February 28, 2018`.
|
|||
But if in some other locale the string would get too long, the localizer can fine
|
||||
tune the options as well:
|
||||
|
||||
.. code-block:: properties
|
||||
.. code-block:: fluent
|
||||
|
||||
welcome-message = Początek Twojej sesji: { DATETIME($startDate, month: "short") }
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ name = "pypi"
|
|||
[packages]
|
||||
backports-abc = "~=0.5"
|
||||
boto3 = "~=1.9.71"
|
||||
"fluent.pygments" = "~=0.1"
|
||||
livereload = "~=2.6.0"
|
||||
recommonmark = "~=0.4.0"
|
||||
scandir = "~=1.9.0"
|
||||
|
@ -14,6 +15,7 @@ sphinx-js = "~=2.1.0"
|
|||
sphinx-rtd-theme = "~=0.4.2"
|
||||
sphinxcontrib-mermaid = "~=0.3.1"
|
||||
sphinx = "~=1.8.5"
|
||||
tornado = "~=5.1.1"
|
||||
|
||||
[requires]
|
||||
python_version = "2.7"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "c92ec73bbe1db1dcd95895aa179404e54304582138a29c728d7b87facd8ee15d"
|
||||
"sha256": "aa602e001de9068273bccfb3484ccfcbe31ac05d8aef6cd352edab142f6e80d0"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
|
@ -47,18 +47,18 @@
|
|||
},
|
||||
"boto3": {
|
||||
"hashes": [
|
||||
"sha256:0cd4a3e158f40eedb54b36b3fbe60d135db74a245f0ca8eead1af2eb6d46a649",
|
||||
"sha256:68e9eba6f846cf8e01973ec565afdb1adfb9612b531c15bb5c5524394db4df5b"
|
||||
"sha256:663d5bb17cfdf706a0c157f6eeb01f5c22a29c7528b49f9f4deb73af27301b19",
|
||||
"sha256:b8796d48f06e8701bd26671bee9936cf6403042ab8e79d6561b1e8496a31d19b"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.9.199"
|
||||
"version": "==1.9.209"
|
||||
},
|
||||
"botocore": {
|
||||
"hashes": [
|
||||
"sha256:25d87047241b7b775443570c0e790ca952f9f7491d4d6472430a4b006383a257",
|
||||
"sha256:e4729c1acaa936d4c5c948a18d279f92bbf61fad9b5fb03942c753ec405e427d"
|
||||
"sha256:8be475b83c3b654a78c2aa195dc4c82852a31c2e72b32b73f570260ae6451eba",
|
||||
"sha256:bf2dcd604a83b045df0870486c3252785734b1cbe167752b8f777d8174218e64"
|
||||
],
|
||||
"version": "==1.12.199"
|
||||
"version": "==1.12.209"
|
||||
},
|
||||
"certifi": {
|
||||
"hashes": [
|
||||
|
@ -82,11 +82,26 @@
|
|||
},
|
||||
"docutils": {
|
||||
"hashes": [
|
||||
"sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6",
|
||||
"sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274",
|
||||
"sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6"
|
||||
"sha256:6c4f696463b79f1fb8ba0c594b63840ebd41f059e92b31957c46b74a4599b6d0",
|
||||
"sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827",
|
||||
"sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99"
|
||||
],
|
||||
"version": "==0.14"
|
||||
"version": "==0.15.2"
|
||||
},
|
||||
"fluent.pygments": {
|
||||
"hashes": [
|
||||
"sha256:4fa2e83322b559a2f9f43af8cb383569534d9424c68d4fe7ca75c5bf091572c6",
|
||||
"sha256:7a552a056e229203ac8d4321316a0075dec53a70c8afbcf4ea48482e3af05860"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==0.1.0"
|
||||
},
|
||||
"fluent.syntax": {
|
||||
"hashes": [
|
||||
"sha256:33de260240f1c0a5878bf7d6a7a32a73b5301c35d0f946efce161a6c5dcf3a79",
|
||||
"sha256:e9037206b27c714a692f281d91ff144c92fd0f4d8e34766bcb3852ac13778632"
|
||||
],
|
||||
"version": "==0.16.0"
|
||||
},
|
||||
"futures": {
|
||||
"hashes": [
|
||||
|
@ -314,6 +329,7 @@
|
|||
"sha256:d4b3e5329f572f055b587efc57d29bd051589fb5a43ec8898c77a47ec2fa2bbb",
|
||||
"sha256:e5f2585afccbff22390cddac29849df463b252b711aa2ce7c5f3f342a5b3b444"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==5.1.1"
|
||||
},
|
||||
"typing": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче