Permalink
Browse files

Documenting current workflow while writing blog post

  • Loading branch information...
1 parent f2db522 commit 2bec592e247aeda3922d497e4e15dbde738c81e9 @ozten ozten committed Jan 30, 2013
View
@@ -28,8 +28,11 @@ for pofile in `find $1 -type f -name "*.po"`; do
stem=`basename $pofile .po`
jsonfile="$2/${lang}/${stem}.json"
mkdir -p $2/${lang}
+echo "I am working in "
+pwd
+echo "and 1 is $1 and 2 is $2"
echo -n ";var json_locale_data = " > $jsonfile
- $1/po2json.js -p $pofile >> $jsonfile
+ ./node_modules/.bin/po2json.js -p $pofile >> $jsonfile
echo ";" >> $jsonfile
done
rm $lockfile
View
@@ -40,6 +40,10 @@ config file which you'll like to validate. Examples:
CONFIG_FILES=/home/ozten/Projects/browserid/config/l10n-prod.json node ./scripts/check-l10n-config.js
CONFIG_FILES=/home/ozten/Projects/browserid/config/l10n-all.json node ./scripts/check-l10n-config.js
+## Contributions
+
+``scripts/check-po.sh`` - Prints statistics on various .po files, assumes `locale` directory.
+
## Debugging
If code is evaluated in node.js (server-side) then node-gettext is providing the string
View
@@ -38,6 +38,6 @@ app.configure('production', function(){
app.get('/', routes.index);
-app.listen(3000, function(){
+app.listen(3001, function(){
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
});
@@ -0,0 +1,12 @@
+;var json_locale_data = {
+ "messages": {
+ "": {
+ "Project-Id-Version": " express 2\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2012-06-24 09:50+0200\nPO-Revision-Date: 2012-06-24 09:50+0200\nLast-Translator: Automatically generated\nLanguage-Team: none\nLanguage: db_LB\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n"
+ },
+ "Hello, world!": [
+ null,
+ ""
+ ]
+ }
+}
+;
@@ -0,0 +1,12 @@
+;var json_locale_data = {
+ "messages": {
+ "": {
+ "Project-Id-Version": " express 2\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2012-06-24 09:50+0200\nPO-Revision-Date: 2012-06-24 09:50+0200\nLast-Translator: Automatically generated\nLanguage-Team: none\nLanguage: de\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=(n != 1);\n"
+ },
+ "Hello, world!": [
+ null,
+ ""
+ ]
+ }
+}
+;
@@ -0,0 +1,12 @@
+;var json_locale_data = {
+ "messages": {
+ "": {
+ "Project-Id-Version": " express 2\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2012-06-24 09:50+0200\nPO-Revision-Date: 2012-06-24 09:50+0200\nLast-Translator: Automatically generated\nLanguage-Team: none\nLanguage: en_US\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=(n != 1);\n"
+ },
+ "Hello, world!": [
+ null,
+ "Hello, world!"
+ ]
+ }
+}
+;
@@ -0,0 +1,12 @@
+;var json_locale_data = {
+ "messages": {
+ "": {
+ "Project-Id-Version": " express 2\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2012-06-24 09:50+0200\nPO-Revision-Date: 2012-06-24 09:50+0200\nLast-Translator: Automatically generated\nLanguage-Team: none\nLanguage: es\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=(n != 1);\n"
+ },
+ "Hello, world!": [
+ null,
+ ""
+ ]
+ }
+}
+;
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+echo "Extracting strings"
+mkdir -p locale/templates/LC_MESSAGES
+./node_modules/i18n-abide/bin/extract-pot -l ./locale .
+
+# Create PO files
+for locale in en_US es de db_LB; do
+ echo "Creating ${locale} language files"
+ mkdir -p locale/${locale}/LC_MESSAGES
+ mkdir -p i18n/${locale}
+ msginit --input=./locale/templates/LC_MESSAGES/messages.pot \
+ --output-file=./locale/${locale}/LC_MESSAGES/messages.po \
+ -l ${locale} --no-translator
+ echo "You can translate i18n/${locale}/messages.json"
+done
+
+# Convert PO files to JSON
+./node_modules/i18n-abide/bin/compile-json.sh locale i18n
+
+# Make current version of the code happy
+./node_modules/i18n-abide/bin/compile-mo.sh locale
View
@@ -68,16 +68,21 @@ exports.abide = function (options) {
options.supported_languages.forEach(function (lang, i) {
var l = localeFrom(lang),
default_locale = localeFrom(options.default_lang);
-
+ console.log(l, mo_file_path(l), exists(mo_file_path(l)));
mo_cache[l] = {
- mo_exists: path.exists(mo_file_path(l)),
+ mo_exists: exists(mo_file_path(l)),
/* json_exists: path.exists(json_file_path(l)), */
gt: null
};
if (l !== debug_locale) {
if (! mo_cache[l] || ! mo_cache[l].mo_exists /* || ! mo_cache[l].json_exists*/ ) {
+
+ console.log('mo_cache?', mo_cache[l], ' for ', l);
+ if (mo_cache[l]) console.log('mo_exists?', mo_cache[l].mo_exists);
var msg = util.format('Bad locale=[%s] file(s) do not exist [%s]. See locale/README',
l, mo_file_path(l)/*, json_file_path(l)*/);
+
+ console.log(l, default_locale);
if (/* mo_cache[l].json_exists && */ l == default_locale) {
// mo files aren't critical... carry on
if (! options.disable_locale_check) logger.warn(msg);
View
@@ -2,7 +2,7 @@
"author": "Austin King <shout@ozten.com> (http://ozten.com)",
"name": "i18n-abide",
"description": "Express/connect module for Node i18n and l10n support",
- "version": "0.0.7",
+ "version": "0.0.8beta",
"homepage": "https://github.com/mozilla/i18n-abide",
"repository": {
"type": "git",

0 comments on commit 2bec592

Please sign in to comment.