Skip to content

Instantly share code, notes, and snippets.

rgoupil /
Last active Jun 20, 2022 — forked from paumoreno/
Extract all messages from a Vue.js with vue-i18n app, using gettext-extractor.

This script uses the great message extraction library gettext-extractor by lukasgeiter.

The script assumes that the location of the source files is ./src. It parses both .js and .vue files. It writes the PO template file in ./i18n/messages.pot.

Some things to note:

  • It assumes that interpolations in the templates use the delimieters {{}} (it is the most commmon case).
  • It assumes that both the template and the script sections of the .vue single file components are defined inline, and not referenced by a src attribue (it is the most common case).
  • Expressions to extract are hardcoded. Currently they are ['$t', '[this].$t', 'i18n.t'].
rgoupil / array.ts
Last active May 10, 2022
Utility functions for Array and Generator - TS target must be >= ES2018
View array.ts
declare global {
interface Array<T> {
toArray(): Array<T>;
* Same as but can take an async transform function while still iterating sequentially
mapAsync<R>(fn: (item: T, i: number, array: ThisType<T>) => Promise<R>): Promise<Array<R>>;
View math_ext.cs
using Unity.Mathematics;
public static class math_ext
private static float2 vect2d(float2 p1, float2 p2)
float2 temp;
temp.x = (p2.x - p1.x);
temp.y = -(p2.y - p1.y);
return temp;
View bitbucket_team_filter.userscript.js
// ==UserScript==
// @name Bitbucket PR author filter
// @namespace
// @version 0.1
// @description Allow to filter PRs on bitbucket by author
// @author You
// @match
// @match*
// @grant GM_xmlhttpRequest
// @grant GM_addStyle