Skip to content

Instantly share code, notes, and snippets.

View maerzbow's full-sized avatar

Markus Merzinger maerzbow

View GitHub Profile
@maerzbow
maerzbow / en-us.constants.json
Created December 3, 2018 11:25
Lingohub example go-i18n.json
[
{
"id": "d_days",
"translation": {
"one": "{{.Count}} day",
"other": "{{.Count}} days"
}
},
{
"id": "my_height_in_meters",
@maerzbow
maerzbow / EnsureEncoding.java
Last active November 16, 2018 00:19
EnsureEncoding.java
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.nio.charset.StandardCharsets.UTF_16BE;
import static java.nio.charset.StandardCharsets.UTF_16LE;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2"
xmlns="urn:oasis:names:tc:xliff:document:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-strict.xsd">
<file original="sample.properties"
source-language="en" target-language="de"
datatype="javapropertyresourcebundle">
<body>
<trans-unit id="1" resname="key1">
@maerzbow
maerzbow / php_define.php
Created May 24, 2016 16:22
example file for php define i18n segments
<?php
# A header comment for
# the file.
# a comment for the LOGOFF segment
define('LOGOFF', 'Log off');
define("DOUBLE_QUOTES", "'single' and \"double\" quotes");
define("SINGLE_QUOTES", '\'single\' and "double" quotes');
DEFINE('PLACEHOLDER', 'Hello %s!');
DEFINE('MULTI_LINE', 'A multi line \n string.');
<?xml version="1.0" encoding="utf-8"?>
<root>
<data name="Common_AuthenicationFailed" xml:space="preserve">
<value>Authentifikation fehlgeschlagen</value>
<comment>comment will be assigned as description to translation "Common_AuthenicationFailed"</comment>
</data>
<data name="Common_Billable" xml:space="preserve">
<value>Verrechenbar</value>
<comment>lh-check { min: 10, max: 15 }</comment>
</data>
# header comment
msgid ""
msgstr ""
"Project-Id-Version: LingoHub 1.6.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-05-05 19:22+0200\n"
"PO-Revision-Date: 2013-04-29 10:16+0100\n"
"Last-Translator: Translator <translator@lingohub.com>\n"
"MIME-Version: 1.0\n"
@maerzbow
maerzbow / push_resource_files.sh
Created January 19, 2013 20:38
pushing resource files to lingohub using the lingohub CLI client. see: https://www.ruby-toolbox.com/projects/lingohub
lingohub resource:up config/locales/en/en.yml --locale 'en' --project 'lht'
lingohub resource:up config/locales/de/de.yml --locale 'de' --project 'lht'
lingohub resource:up config/locales/ja/ja.yml --locale 'ja' --project 'lht'
@maerzbow
maerzbow / retrieve_resource_files.sh
Created January 19, 2013 20:16
retrieving resource files from lingohub using the lingohub CLI client. see: https://www.ruby-toolbox.com/projects/lingohub
lingohub resource:down --locale 'en' --directory config/locales/en --project 'lht' --all
lingohub resource:down --locale 'de' --directory config/locales/de --project 'lht' --all
lingohub resource:down --locale 'ja' --directory config/locales/ja --project 'lht' --all
@maerzbow
maerzbow / example.resjson
Created November 15, 2012 09:00
resjson example
{
"sc7MessageCount" : "Anzahl der Nachrichten: <span data-win-bind=\"innerText:count\" ></span>",
"_sc7MessageCount.source" : "You have <span data-win-bind=\"innerText:count\"></span> message(s)",
"_sc7MessageCount.comment" : "Do not change the HTML markup.",
"sc9AddressLabel" : "Adresse:",
"_sc9AddressLabel.source" : "Address",
"_sc9AddressLabel.comment" : "the address of the user"
}
@maerzbow
maerzbow / ensure_encoding_given.rb
Created July 22, 2012 19:53
ensure_encoding with input encodings given
input.ensure_encoding('UTF-8',
:external_encoding => [::Encoding::UTF_8, ::Encoding::UTF_16LE, ::Encoding::UTF_16BE,
::Encoding::ISO_8859_1],
:invalid_characters => :transcode)