Skip to content

Instantly share code, notes, and snippets.

View mathjazz's full-sized avatar

Matjaž Horvat mathjazz

View GitHub Profile
@mathjazz
mathjazz / demo.ftl
Created December 2, 2016 18:34
L20n demo export
title = O lokalizaciji
feedbackUninstallCopy =
| Vaše sodelovnjae bla bla
| Let's continue in the next line
| And the next one...
emailOptInInput =
[html/placeholder] e-poštni naslov :)
Snowball:mozilla-pontoon mathjazz$ heroku info -a mozilla-pontoon
=== mozilla-pontoon
Addons: cloudamqp:tiger
heroku-postgresql:standard-0
memcachier:100
papertrail:volmar
raygun:small
scheduler:standard
sendgrid:starter
ssl:endpoint
(function () {
var script = document.getElementById('highcharts-script');
function addChart() {
function parseData(completeHandler, chartOptions) {
try {
var dataOptions = {
"seriesMapping": [
{
"x": 0
(venv)Snowball:pontoon mathjazz$ psql -f new_filters.dump pontoon
SET
SET
SET
SET
SET
SET
psql:new_filters.dump:14: ERROR: unrecognized configuration parameter "row_security"
CREATE EXTENSION
COMMENT
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (type
Snowball:projectfluent.github.io mathjazz$ npm start
> [email protected] start /Library/WebServer/Documents/projectfluent.github.io
> react-scripts start
/Library/WebServer/Documents/projectfluent.github.io/node_modules/react-scripts/node_modules/cross-spawn/index.js:34
throw new Error(
^
Error: In order to use spawnSync on node 0.10 or older, you must install spawn-sync:
from pontoon.base.models import *
from bulk_update.helper import bulk_update
tm_entries_to_update = []
"""
Generate a dict of TM entries where translation ForeignKey is null
- key: serialized TM entry data
- value: reference to a TM entry
"""
@mathjazz
mathjazz / tm.py
Last active March 12, 2021 14:00
tm.py
import time
from pontoon.base.models import TranslationMemoryEntry, Translation
from bulk_update.helper import bulk_update
tm_entries_to_update = []
"""
Generate a dict of TM entries for which translation ForeignKey is null
- key: serialized TM entry data
- value: reference to a TM entry
@mathjazz
mathjazz / Current.py
Created June 1, 2017 16:22
Current.py
entities = (
Entity.objects.filter(
Q(translation__string__icontains_collate=search_query, translation__locale=locale) | Q(translation__entity_document__icontains=search),
pk__in=entities
)
.distinct()
)
Proposal: ActiveEntityTranslation table for faster searching and filtering of entities.
Let's create a table of all active translations. Active translation is a translation that is displayed in the string list (left panel), translation editor (right panel), and as the first item in the History tab. It's either an approved translation, latest suggestion or "None" if the entity hasn't been translated for locale.
I'd like to run this as a quick experiment to see if it can lead us to faster filtering, searching and loading of strings in the translation interface.
Such table will allow us to replace most of the logic in several pieces of pontoon.base.models:
- Entity.get_translation()
- Entity.for_project_locale()
- Entity.map_entities()