<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Diego Búrigo Zacarão's Weblog &#187; Transifex</title>
	<atom:link href="http://diegobz.net/category/transifex/feed/" rel="self" type="application/rss+xml" />
	<link>http://diegobz.net</link>
	<description>Let me talk about something</description>
	<lastBuildDate>Mon, 01 Aug 2011 14:53:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>FISL 12</title>
		<link>http://diegobz.net/2011/07/18/fisl-12/</link>
		<comments>http://diegobz.net/2011/07/18/fisl-12/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 19:59:53 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[FISL]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Indifex]]></category>
		<category><![CDATA[Transifex]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[fisl]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=384</guid>
		<description><![CDATA[How nice was to be one more time at FISL. It was my 5th edition and it could have been the 6th, if I haven&#8217;t had missed the 2010 one. I remember well when back there, 5 years ago, I and a friend of mine took a bus and went to Porto Alegre for our [...]]]></description>
			<content:encoded><![CDATA[<p>How nice was to be one more time at FISL. It was my 5th edition and it could have been the 6th, if I haven&#8217;t had missed the 2010 one. I remember well when back there, 5 years ago, I and a friend of mine took a bus and went to Porto Alegre for our first contact with the Free Software community. At that time I wasn&#8217;t involved to any FOSS effort, but that was definitely a starter point to me.</p>
<p><a href="http://softwarelivre.org/fisl12/"><img class="alignright" title="FISL 12" src="/wp-content/uploads/2011/07/logo-fisl121.png" alt="" width="214" height="204" /></a>FISL is all about meeting people, opportunities and making friends. You can find practically any kind of geek over there and for the major part of those, you will just be able to meet them in person again in the next FISL.</p>
<p>This year I have met a bunch of &#8216;old&#8217; FISL guys, people that I have been in touch since FISL 6 and some other new guys. Great people. From those, I couldn&#8217;t not mention the Fedora guys. This year we had the current Fedora Project leader, <a href="http://www.jaredsmith.net/" target="_blank">Jared Smith</a>, among us and it was really cool to meet him in person.</p>
<p>I&#8217;m really glad that I was able to make it this year. We had a presentation about Transifex in the main schedule and also got mentioned in the <a href="http://softwarelivre.org/fisl12/speakers" target="_blank">speakers list</a> of the event. Hopefully the video of the presentation (in pt_BR) will be available in the following weeks, but you can find the <a href="http://diegobz.net/wp-content/uploads/2011/07/Transifex-FISL12.pdf" target="_blank">slides here</a> for now. <img src='http://diegobz.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2011/07/18/fisl-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dear (Slovenian) Translator</title>
		<link>http://diegobz.net/2011/02/17/dear-slovenian-translator/</link>
		<comments>http://diegobz.net/2011/02/17/dear-slovenian-translator/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 20:05:37 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Transifex]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=370</guid>
		<description><![CDATA[Last week we came across an issue involving a request from Django. A person from the Slovenian team filed a ticket on the Django system asking to change the plural equation for the translation files. Once Django is now officially using Transifex for managing its translations, this ended up here to us. Long short history&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Last week we came across an issue involving a request from Django. A person from the Slovenian team filed a <a href="http://code.djangoproject.com/ticket/14129" target="_blank">ticket on the Django system</a> asking to change the plural equation for the translation files. Once Django is now officially using Transifex for managing its translations, this ended up here to us.</p>
<p>Long short history&#8230;</p>
<p>Transifex plural rules are based on <a href="http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sl" target="_blank">this document</a>. The possible plural rules currently supported are 6, <strong>*always*</strong> in the respect order:</p>
<blockquote><p>zero, one, two, few, many, other</p></blockquote>
<p>The &#8216;other&#8217; rule is the general exception for anything that doesn&#8217;t fit into the other rules. For Japanese, for example, that doesn&#8217;t have plural forms, it only uses the &#8216;other&#8217; rule and nothing else.</p>
<p>According to the document above, Slovenian has 4 plural rules, which are:</p>
<blockquote><p>one → n mod 100 is 1;<br />
two → n mod 100 is 2;<br />
few → n mod 100 in 3..4;<br />
other → everything else</p></blockquote>
<p>For the PO file format, the plural equation for the above would be:</p>
<blockquote><p>(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3)</p></blockquote>
<p>Which means that for a sl.po with a plural entry, we would have the following mapping:</p>
<blockquote><p>msgstr[0] → one<br />
msgstr[1] → two<br />
msgstr[2] → few<br />
msgstr[3] → other</p></blockquote>
<p>Back to the initial issue, for some reason good part of the Slovenian teams across the FOSS world started to prefer to use the following plural equation:</p>
<blockquote><p>(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0)</p></blockquote>
<p>This results in the following swapping of position:</p>
<blockquote><p>msgstr[0] → other<br />
msgstr[1] → one<br />
msgstr[2] → two<br />
msgstr[3] → few</p></blockquote>
<p>This, as far as I know, because the &#8216;zero&#8217; rule, which actually doesn&#8217;t exist for the language, just fits as the &#8216;other&#8217; rule and in this way the &#8216;one&#8217; and &#8216;two&#8217; rules would have a synchronized msgstr index (e.g. msgstr[1] → one).</p>
<p><strong>So, dear Slovenian translator, is there any other reason for doing it that I&#8217;m not aware of?</strong></p>
<p>Changing that because of the above seems just wrong to me. And I would like to ask a greater audience of people that might be interested on it, before taking any decision on the Transifex side.</p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2011/02/17/dear-slovenian-translator/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Django Database Router using settings</title>
		<link>http://diegobz.net/2011/02/10/django-database-router-using-settings/</link>
		<comments>http://diegobz.net/2011/02/10/django-database-router-using-settings/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 18:53:32 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Transifex]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=346</guid>
		<description><![CDATA[It&#8217;s been a while without passing here&#8230; but let&#8217;s not talk about it! So, this week I just came across an issue related to how to setup multiple databases on Django. Reading the documentation I found it quite trivial to setup. After having the databases configured, you can use a Database Router, if you want [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while without passing here&#8230; but let&#8217;s not talk about it! <img src='http://diegobz.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So, this week I just came across an issue related to <strong>how to setup multiple databases on Django</strong>. Reading the <a title="Django docs for multi-db" href="http://docs.djangoproject.com/en/1.2/topics/db/multi-db/" target="_blank">documentation</a> I found it quite trivial to setup. After having the databases configured, you can use a <strong>Database Router</strong>, if you want to automatically route your app models, or use <em><strong>.using(&#8216;db1&#8242;)</strong> </em>manually on your queries, specifying the wanted database.</p>
<p>As I didn&#8217;t want to specify the databases on the queries in my code, so I decided to use the<strong> Database Router</strong>, which is, by the way, a very nice solution for such a problem. Looking at the example on the Django docs, I realized that the example was only covering the routing of an unique app. Looking further, I also noticed that it was a bit tied with placeholders related to the app and the database names inside the class. Then I asked myself:</p>
<p><strong>Couldn&#8217;t it be more generic and reusable for more than one app?</strong></p>
<p>Searching a bit on the Web I couldn&#8217;t find anything. Having that in mind, I came with the following code that can be used to specify several apps using different databases. Everything just using a single settings variable and in a very simple way:</p>
<pre class="brush:py">from django.conf import settings

class DatabaseAppsRouter(object):
    """
    A router to control all database operations on models for different
    databases.

    In case an app is not set in settings.DATABASE_APPS_MAPPING, the router
    will fallback to the `default` database.

    Settings example:

    DATABASE_APPS_MAPPING = {'app1': 'db1', 'app2': 'db2'}
    """

    def db_for_read(self, model, **hints):
        """"Point all read operations to the specific database."""
        if settings.DATABASE_APPS_MAPPING.has_key(model._meta.app_label):
            return settings.DATABASE_APPS_MAPPING[model._meta.app_label]
        return None

    def db_for_write(self, model, **hints):
        """Point all write operations to the specific database."""
        if settings.DATABASE_APPS_MAPPING.has_key(model._meta.app_label):
            return settings.DATABASE_APPS_MAPPING[model._meta.app_label]
        return None

    def allow_relation(self, obj1, obj2, **hints):
        """Allow any relation between apps that use the same database."""
        db_obj1 = settings.DATABASE_APPS_MAPPING.get(obj1._meta.app_label)
        db_obj2 = settings.DATABASE_APPS_MAPPING.get(obj2._meta.app_label)
        if db_obj1 and db_obj2:
            if db_obj1 == db_obj2:
                return True
            else:
                return False
        return None

    def allow_syncdb(self, db, model):
        """Make sure that apps only appear in the related database."""
        if db in settings.DATABASE_APPS_MAPPING.values():
            return settings.DATABASE_APPS_MAPPING.get(model._meta.app_label) == db
        elif settings.DATABASE_APPS_MAPPING.has_key(model._meta.app_label):
            return False
        return None
</pre>
<p>I hope the code can self explain what each one of those methods do. And, of course, it&#8217;s a generic solution that might be customized as needed. <img src='http://diegobz.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2011/02/10/django-database-router-using-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django reverse with JavaScript</title>
		<link>http://diegobz.net/2010/07/16/django-reverse-with-javascript/</link>
		<comments>http://diegobz.net/2010/07/16/django-reverse-with-javascript/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 21:06:39 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Transifex]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=336</guid>
		<description><![CDATA[Taking the cobwebs out of here… Here I go to cite a way that can &#8216;solve&#8217; the URL reversing problem when you are using a Django app that uses some JavaScript and Ajax requests. Django has a very nice way to resolve URLs based on its name and optionally some args. It uses the regex [...]]]></description>
			<content:encoded><![CDATA[<p>Taking the cobwebs out of here…</p>
<p>Here I go to cite a way that can &#8216;solve&#8217; the URL reversing problem when you are using a Django app that uses some JavaScript and Ajax requests.</p>
<p>Django has a very nice way to resolve URLs based on its name and optionally some args. It uses the regex pattern defined in the related urls.py file of the given app. Example:</p>
<blockquote><p>from django.core.urlresolvers import reverse</p>
<p>reverse(&#8216;project_detail&#8217;, args=['foo'])<br />
&#8216;/projects/p/foo/&#8217;</p>
<p>reverse(&#8216;project_detail&#8217;, args=['bar'])<br />
&#8216;/projects/p/bar/&#8217;</p></blockquote>
<p>The problem turns when you want to make a Ajax request based on some dynamic data from a form or something. As some URLs sometimes need arguments to be resolved, we can&#8217;t always pre-reverse and attach them to the Context, on the Django response.</p>
<p>For the record, I found an alternative <a href="http://stackoverflow.com/questions/2724383/dry-urls-in-django-javascript" target="_blank">here</a>. With it you can take the args from the browser and request through Ajax to Django the resolved URL. It&#8217;s pretty cool, but I think it was a bit expensive to multiply by 2 the number of requests to the server.</p>
<p>It made me think on another approach, where I would pre-fill in the Context response of Django, the URL already resolved, but with named args like, %(project)s, for the required arguments. I ended up with this:</p>
<blockquote><p>from django.core.urlresolvers import get_resolver</p>
<p>def get_url_pattern(urlname):<br />
&#8220;&#8221;"<br />
Return pattern for an URL based on its name.</p>
<p>&gt;&gt;&gt; get_url_pattern(&#8216;project_deails&#8217;)<br />
u&#8217;/projects/p/%(project_slug)s/&#8217;</p>
<p>&#8220;&#8221;"<br />
return &#8216;/%s&#8217; % get_resolver(None).reverse_dict.get(urlname)[0][0][0]</p></blockquote>
<p>As you can notice, passing an URL name to that function will give you the resolved URL with named args. I&#8217;m not really aware about corner cases, so feel free to give any comment on it.</p>
<p>Once you have the URL as a string with named args, you can use this <a href="http://plugins.jquery.com/project/printf" target="_blank">JQuery plugin</a>, to resolve the named args using only JavaScript in the client side.</p>
<p>&#8230; and that&#8217;s it! <img src='http://diegobz.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2010/07/16/django-reverse-with-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>It&#8217;s been 1 year of Indifex</title>
		<link>http://diegobz.net/2010/02/01/its-been-1-year-of-indifex/</link>
		<comments>http://diegobz.net/2010/02/01/its-been-1-year-of-indifex/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 13:09:52 +0000</pubDate>
		<dc:creator>diegobz</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Europe]]></category>
		<category><![CDATA[FUDCon]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Indifex]]></category>
		<category><![CDATA[Transifex]]></category>

		<guid isPermaLink="false">http://diegobz.net/?p=283</guid>
		<description><![CDATA[Time definitely flies It looks like it was yesterday that I firstly flew to EU to meet some Fedora guys at the FUDCon in Brno. At that time, September of 2008, I had just finished my GSoC application and lots of ideas were going around our minds (Me and Dimitris Glezos), mainly about what we [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Time definitely flies</strong></p>
<p>It looks like it was yesterday that I firstly flew to EU to meet some Fedora guys at the FUDCon in Brno. At that time, September of 2008, I had just finished my <a title="GSoC blog posts" href="http://diegobz.net/category/gsoc/" target="_blank">GSoC application</a> and lots of ideas were going around our minds (Me and Dimitris Glezos), mainly about what we should do about <a href="http://transifex.org/" target="_blank">Transifex</a>.</p>
<p>My first time in Greece, Dimitris&#8217; country, allowed us to discuss many things, including the redesign of Transifex. I remember we realized we had in our hands an idea that, at least for us, could sound very promising and with lots of potential. We were kinda anxious and unsure on how we should push things on, but we had a shared common feeling -  We need to do something.</p>
<div style="text-align: center;">
<div class="imageframe centered" style="width: 500px;"><img class="attachment wp-att-289" src="http://diegobz.net/wp-content/uploads/2010/02/time-flies.jpg" alt="Time Flies by Bichuas (E. Carton)" width="500" height="334" /></p>
<div class="imagecaption">Time Flies by Bichuas (E. Carton)</div>
</div>
</div>
<p>In a long short history, I came back to Brazil in November of 2008 and 3 months later I was working full time on Transifex as an <a title="Indifex website" href="http://indifex.com" target="_blank">Indifexian</a>. February of 2009 was a mark for me. At that period, my life was kinda turned up side down, not in a bad way, just in a complete different way. New challenges and horizons  just shown up and it&#8217;s been like this until now, 1 year later.</p>
<p>Today we are not anymore 2 crazy guys, locked down in an apartment, ordering food and hacking most of the time during the night.  The team has increased and we are really happy about it. We keep working hard to hit our goals seeking ways to make &#8216;Translations a click away&#8217;. Talking about it, <a href="http://docs.transifex.org/releases/0.8.html#transifex-0-8-alpha" target="_blank">Transifex 0.8alpha</a> is just out, be sure to take a look at the new features. <img src='http://diegobz.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Happy translations!</p>
]]></content:encoded>
			<wfw:commentRss>http://diegobz.net/2010/02/01/its-been-1-year-of-indifex/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

