Skip to content

Instantly share code, notes, and snippets.

@hlassiege
hlassiege / i18nformat.csv
Created May 3, 2018 09:42
i18nformat.csv
Langage Format Mécanisme de fallback Utilisation des codes ISO
Java ResourceBundle Oui Oui
.Net Fichiers Resx Oui Oui
PHP (*) ICU depuis la 5.3.0 ou Tableau ou PO (**) Oui pour ICU et PO - Non pour les tableaux Oui pour ICU et PO - Non pour les tableaux
Python PO (**) Oui Oui
C++ PO (**) Oui Oui
@hlassiege
hlassiege / xmlcharset.xml
Created May 3, 2018 09:32
xmlcharset.xml
<?xml version="1.0" encoding="UTF-8"?>
@hlassiege
hlassiege / requireonce.php
Created May 3, 2018 09:32
requireonce.php
require_once 'langs/'.$lang.'.php';
@hlassiege
hlassiege / readtranslation.php
Created May 3, 2018 09:32
readtranslation.php
echo $myTransations[‘string1’];
@hlassiege
hlassiege / phpheadercharset.php
Created May 3, 2018 09:31
phpheadercharset.php
<? header('Content-Type: text/html; charset=utf-8'); ?>
@hlassiege
hlassiege / numberformatdate.java
Created May 3, 2018 09:31
numberformatdate.java
DateFormat df = DateFormat.getDateInstance();
myDate = df.parse(myString);
@hlassiege
hlassiege / numberformatcurrency.java
Created May 3, 2018 09:31
numberformatcurrency.java
NumberFormat nf = NumberFormat.getCurrencyInstance();
nf.format(1234.56);
@hlassiege
hlassiege / numberformat.java
Created May 3, 2018 09:31
numberformat.java
NumberFormat nf = NumberFormat.getInstance(); // pour utiliser la Locale courante
ou
NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH); // pour spécifier une Locale
myNumber = nf.parse(myString);
@hlassiege
hlassiege / mysqlpythonconnection.txt
Created May 3, 2018 09:30
mysqlpythonconnection.txt
import MySQLdb
db = MySQLdb.connect(host=DB_HOST ,user=DB_USER ,passwd=DB_PASS,db=DB_NAME, charset = "utf8", use_unicode = True)
@hlassiege
hlassiege / mysqlphpconnection.txt
Created May 3, 2018 09:30
mysqlphpconnection.txt
mysql_connect("serveur","login","pass");
mysql_select_db("myDbUtf8");
mysql_query("SET NAMES 'utf8'");