Skip to content

Instantly share code, notes, and snippets.

View stasm's full-sized avatar

Stanisław Małolepszy stasm

View GitHub Profile
@stasm
stasm / test.py
Last active May 7, 2018 13:04 — forked from flodolo/test.py
# coding=utf8
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import absolute_import
import fluent.syntax.ast as FTL
from fluent.migrate import COPY
from fluent.migrate.helpers import transforms_from
@stasm
stasm / preferences-bare.ftl
Created December 20, 2017 17:09
A comparison of two Fluent files, with and without the required = after the identifier
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
pref-page
.title = { PLATFORM() ->
[win] Options
*[other] Preferences
}
@stasm
stasm / bug_1411012.py
Created November 7, 2017 15:10
Migration stub for bug 1411012
# coding=utf8
import fluent.syntax.ast as FTL
from fluent.migrate import COPY
def migrate(ctx):
"""Bug 1411012 - Migrate privacy settings to FTL, part {index}"""
ctx.maybe_add_localization(
@stasm
stasm / multi-level-comments.ftl
Last active October 20, 2017 14:01
Muti-level comments in FTL
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
### Localization for Server-side strings of Firefox Screenshots
### Please don't localize Firefox, Firefox Screenshots, or Screenshots
## Global phrases shared across pages, prefixed with 'g'
gMyShots = My Shots
@stasm
stasm / attrs.ftl
Last active October 5, 2017 20:45 — forked from zbraniecki/attrs.ftl
Experiment with FTL syntax
key = Value
key.attr = Attribute
key.attr2 = Attribute 2
key.attr = Attribute
key.attr2 = Attribute 2
key =
Multiline
Value
@stasm
stasm / doc.md
Last active February 22, 2017 00:53

Classes

MessageContext

Message contexts are single-language stores of translations. They are responsible for parsing translation resources in the FTL syntax and can format translation units (entities) to strings.

Always use MessageContext.format to retrieve translation units from a context. Translations can contain references to other entities or external arguments, conditional logic in form of select expressions, traits

# Try editing the translations here!
shared-photos = { $user_name } { $photo_count ->
[0] hasn't added any photos yet
[one] added a new photo
*[other] added { $photo_count } new photos
}.
liked-comment = { $user_name } liked your comment on { $user_gender ->
[male] his
@stasm
stasm / workload-low.ftl
Last active February 27, 2023 13:42
An example of a large file, FTL v0.2.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# browser/locales/en-US/browser/menubar.ftl
[[ File menu ]]
@stasm
stasm / Template.js
Created July 26, 2016 14:50
Polymer's HTMLTemplateElement polyfill
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.7.22-251f4af
@stasm
stasm / .env
Last active December 17, 2021 18:20
Pontoon in Docker
SECRET_KEY=hiphopopotamus
DJANGO_DEV=True
DJANGO_DEBUG=True
DATABASE_URL=postgres://pontoon:pontoon@localhost/pontoon
SESSION_COOKIE_SECURE=False
SITE_URL=http://localhost:8000
FXA_CLIENT_ID=2651b9211a44b7b2
FXA_SECRET_KEY=a3cafccbafe39db54f2723f8a6f804c337e362950f197b5b33050d784129d570
FXA_OAUTH_ENDPOINT=https://oauth-stable.dev.lcip.org/v1
FXA_PROFILE_ENDPOINT=https://stable.dev.lcip.org/profile/v1