From ff90422d0de25c2f87339ef7ebb19f7cd1ebdba9 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Mon, 11 Jan 2010 15:39:00 +0100 Subject: [PATCH] add django-rosetta to make translators' lives easier: A Django application that eases the translation process of your Django projects --- COPYRIGHT | 37 + pyweb/rosetta/__init__.py | 36 + pyweb/rosetta/conf/__init__.py | 24 + pyweb/rosetta/conf/settings.py | 61 + pyweb/rosetta/locale/de/LC_MESSAGES/django.mo | Bin 0 -> 2862 bytes pyweb/rosetta/locale/de/LC_MESSAGES/django.po | 174 ++ pyweb/rosetta/locale/es/LC_MESSAGES/django.mo | Bin 0 -> 2715 bytes pyweb/rosetta/locale/es/LC_MESSAGES/django.po | 171 ++ pyweb/rosetta/locale/fr/LC_MESSAGES/django.mo | Bin 0 -> 2910 bytes pyweb/rosetta/locale/fr/LC_MESSAGES/django.po | 172 ++ pyweb/rosetta/locale/hu/LC_MESSAGES/django.mo | Bin 0 -> 2275 bytes pyweb/rosetta/locale/hu/LC_MESSAGES/django.po | 165 ++ pyweb/rosetta/locale/it/LC_MESSAGES/django.mo | Bin 0 -> 2710 bytes pyweb/rosetta/locale/it/LC_MESSAGES/django.po | 168 ++ pyweb/rosetta/locale/nl/LC_MESSAGES/django.mo | Bin 0 -> 2433 bytes pyweb/rosetta/locale/nl/LC_MESSAGES/django.po | 171 ++ pyweb/rosetta/locale/pl/LC_MESSAGES/django.mo | Bin 0 -> 2640 bytes pyweb/rosetta/locale/pl/LC_MESSAGES/django.po | 170 ++ pyweb/rosetta/locale/ru/LC_MESSAGES/django.mo | Bin 0 -> 2088 bytes pyweb/rosetta/locale/ru/LC_MESSAGES/django.po | 163 ++ pyweb/rosetta/locale/uk/LC_MESSAGES/django.mo | Bin 0 -> 2117 bytes pyweb/rosetta/locale/uk/LC_MESSAGES/django.po | 162 ++ pyweb/rosetta/models.py | 26 + pyweb/rosetta/polib.py | 1443 +++++++++++++++++ pyweb/rosetta/poutil.py | 114 ++ pyweb/rosetta/templates/rosetta/base.html | 41 + .../rosetta/templates/rosetta/css/rosetta.css | 28 + pyweb/rosetta/templates/rosetta/js/rosetta.js | 57 + .../rosetta/templates/rosetta/languages.html | 45 + pyweb/rosetta/templates/rosetta/pofile.html | 125 ++ pyweb/rosetta/templatetags/__init__.py | 24 + pyweb/rosetta/templatetags/rosetta.py | 77 + pyweb/rosetta/urls.py | 32 + pyweb/rosetta/views.py | 322 ++++ pyweb/settings.py | 1 + 35 files changed, 4009 insertions(+) create mode 100644 pyweb/rosetta/__init__.py create mode 100644 pyweb/rosetta/conf/__init__.py create mode 100644 pyweb/rosetta/conf/settings.py create mode 100644 pyweb/rosetta/locale/de/LC_MESSAGES/django.mo create mode 100644 pyweb/rosetta/locale/de/LC_MESSAGES/django.po create mode 100644 pyweb/rosetta/locale/es/LC_MESSAGES/django.mo create mode 100644 pyweb/rosetta/locale/es/LC_MESSAGES/django.po create mode 100644 pyweb/rosetta/locale/fr/LC_MESSAGES/django.mo create mode 100644 pyweb/rosetta/locale/fr/LC_MESSAGES/django.po create mode 100644 pyweb/rosetta/locale/hu/LC_MESSAGES/django.mo create mode 100644 pyweb/rosetta/locale/hu/LC_MESSAGES/django.po create mode 100644 pyweb/rosetta/locale/it/LC_MESSAGES/django.mo create mode 100644 pyweb/rosetta/locale/it/LC_MESSAGES/django.po create mode 100644 pyweb/rosetta/locale/nl/LC_MESSAGES/django.mo create mode 100644 pyweb/rosetta/locale/nl/LC_MESSAGES/django.po create mode 100644 pyweb/rosetta/locale/pl/LC_MESSAGES/django.mo create mode 100644 pyweb/rosetta/locale/pl/LC_MESSAGES/django.po create mode 100644 pyweb/rosetta/locale/ru/LC_MESSAGES/django.mo create mode 100644 pyweb/rosetta/locale/ru/LC_MESSAGES/django.po create mode 100644 pyweb/rosetta/locale/uk/LC_MESSAGES/django.mo create mode 100644 pyweb/rosetta/locale/uk/LC_MESSAGES/django.po create mode 100644 pyweb/rosetta/models.py create mode 100644 pyweb/rosetta/polib.py create mode 100644 pyweb/rosetta/poutil.py create mode 100644 pyweb/rosetta/templates/rosetta/base.html create mode 100644 pyweb/rosetta/templates/rosetta/css/rosetta.css create mode 100644 pyweb/rosetta/templates/rosetta/js/rosetta.js create mode 100644 pyweb/rosetta/templates/rosetta/languages.html create mode 100644 pyweb/rosetta/templates/rosetta/pofile.html create mode 100644 pyweb/rosetta/templatetags/__init__.py create mode 100644 pyweb/rosetta/templatetags/rosetta.py create mode 100644 pyweb/rosetta/urls.py create mode 100644 pyweb/rosetta/views.py diff --git a/COPYRIGHT b/COPYRIGHT index f75b94b..b48e73e 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -132,3 +132,40 @@ License of Mumble (valid for both the images and Murmur*.ice): SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +=============================================================================== + +The directory pyweb/rosetta provides the rosetta Django application that allows +easy editing of Django's translation files. The app is published on Google Code +under the MIT license: + + +Upstream Author: + mbonetti + +Copyright: + + All rights reserved. + +License: + + The MIT License + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + diff --git a/pyweb/rosetta/__init__.py b/pyweb/rosetta/__init__.py new file mode 100644 index 0000000..248ed45 --- /dev/null +++ b/pyweb/rosetta/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" + * Copyright (C) 2010, mbonetti + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. +""" + +VERSION = (0, 5, 1) + +def get_version(svn=False, limit=3): + "Returns the version as a human-format string." + v = '.'.join([str(i) for i in VERSION[:limit]]) + if svn and limit >= 3: + from django.utils.version import get_svn_revision + import os + svn_rev = get_svn_revision(os.path.dirname(__file__)) + if svn_rev: + v = '%s.%s' % (v, svn_rev) + return v diff --git a/pyweb/rosetta/conf/__init__.py b/pyweb/rosetta/conf/__init__.py new file mode 100644 index 0000000..76f7515 --- /dev/null +++ b/pyweb/rosetta/conf/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +""" + * Copyright (C) 2010, mbonetti + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. +""" + diff --git a/pyweb/rosetta/conf/settings.py b/pyweb/rosetta/conf/settings.py new file mode 100644 index 0000000..f8b8849 --- /dev/null +++ b/pyweb/rosetta/conf/settings.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +""" + * Copyright (C) 2010, mbonetti + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. +""" + +from django.conf import settings + +# Number of messages to display per page. +MESSAGES_PER_PAGE = getattr(settings,'ROSETTA_MESSAGES_PER_PAGE',10) + + +# Enable Google translation suggestions +ENABLE_TRANSLATION_SUGGESTIONS = getattr(settings,'ROSETTA_ENABLE_TRANSLATION_SUGGESTIONS',True) + +# Displays this language beside the original MSGID in the admin +MAIN_LANGUAGE = getattr(settings,'ROSETTA_MAIN_LANGUAGE', None) + + +""" +When running WSGI daemon mode, using mod_wsgi 2.0c5 or later, this setting +controls whether the contents of the gettext catalog files should be +automatically reloaded by the WSGI processes each time they are modified. + +Notes: + + * The WSGI daemon process must have write permissions on the WSGI script file + (as defined by the WSGIScriptAlias directive.) + * WSGIScriptReloading must be set to On (it is by default) + * For performance reasons, this setting should be disabled in production environments + * When a common rosetta installation is shared among different Django projects, + each one running in its own distinct WSGI virtual host, you can activate + auto-reloading in individual projects by enabling this setting in the project's + own configuration file, i.e. in the project's settings.py + +Refs: + + * http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode + * http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIReloadMechanism + +""" +WSGI_AUTO_RELOAD = getattr(settings,'ROSETTA_WSGI_AUTO_RELOAD', False) + diff --git a/pyweb/rosetta/locale/de/LC_MESSAGES/django.mo b/pyweb/rosetta/locale/de/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..283f98e251d79c4ce2bae390823932c2eb557ca6 GIT binary patch literal 2862 zcmbuA%WoYu6vjYG|(7xy_AG8>UUvSK0>hQj=2Xg5bt{f0*7}Bfj@B-ulvBazz4t#d;;{~9`HK23%mgy z2R{Vw1-}6Mz^_0);yaMneGl#fe+1d?Zy?*-i642qAKVKb=#E?9qZr5F``~1E{u_{E z`2l<$+=D}Rg9G40;1RF^#vuEVf)9fhWP9&{0lWcn9J{gkGib6GJcIG)m}DLP0C9wP z3C^*9hw-`}d>Q2P$GY=xgD@pDC_&qu{}N<>z6KGhxDB$spF#HP7m)Y;4n7I)fN^xi zevtJ(&>c6yr!hVbegw{Tf4>bL#Q0aR0q%!U*5NG3_Fu(o5WL(SzYDSs*Fo0dV{irh z6s*p}3o?jD@L;NHPvOlzbK~53rs~yx^WEX-%4gPtW7ysZ1NMi{Z;jWyxMcg^|1 zcgXE=JnYwIW6hrJ4)%jD;$c7e&RCBZ@H~j;F+5cp7|eC>4S#fCu&un8nOZPqdr`TD zr|yLK4{JOYwXIVNi7idwy%_xM-07ka=d|w>axLEMXp^CDS50AMN+H*t5*cJ+Gcj(m zLi=2t*M+KHgdd%fX=F{Y7E`*lOVJV*(Q2*?ri~(%>HyRI;(WQjzE;19w}}f@T(oT^ zCZ)+r#7tflDhb*eF;%PJ#k7SZCZk{}IB9$#gX$MEi{2J0C^3^HrE|(8$`AU6m~lGO zMiydLC(9%aHY-;-BxVaGy@JzAn1QvEl5z}24-5?I)`(e1ZL&~kv)u3p#?D=XNA{4X ziPp$8qDacNGC{IuCy&Z8TC$ELWu;CPBB9)_vPG`~l^xP1C}*n0ve4^Qr`oY*OGh1N zuOY^!m~}RDh_cs-X<)FUT!NDpdZDHbKOpAhib62BlT8K4sCNP_7B*QHb4t1-7jw(H z!(MbCWGv=;E8&iXWoO}DkPB6;1;Se}vaK3^Yh}8vTi?%R(>pM&XWq0Wn5cS(Wbc8#WW=y zq6BipLnqtS@Kn1RHm%FXu%%Wenpd(N<9>qUo^IJ?$NkOY|5WEjV$WW zH(QiW7SVa@+CC=JsfK=Z_ypD6(LqD~qtt4g=zAlYwfq4`n^DAcLAkaxTfdy;TH{az z=B`Z4Umd?Rd3yR>ABxUDSG0L}{;v!ETDMg0uh1XNXpn zsZVO_K&fieI2S#I!bH$N=nQU{v|n5{Feu%Um_{imy8{$J>+4E5*Ksn*S7lxZ7D}{1#2xhyGY~uDsxSdf+f;qU%YnD!JIImHO@T}dEV&M0 zd;cyKv7@jTWfmf)WHxRlxrZe>!xeG6RAR2gIwP(^?>Tsi1ljmxQ%H8|E|syjFjUvo zy8ynH>iV|Nup+r!gb&M=F!fDV7lVXwG_DOiEDC7hQ_eQbE@=aG0$E, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Rosetta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-21 12:21+0200\n" +"PO-Revision-Date: 2008-06-16 10:11+0100\n" +"Last-Translator: Martin Mahner \n" +"Language-Team: patrick lauber \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-Language: German\n" +"X-Poedit-Country: SWITZERLAND\n" + +#: templates/rosetta/languages.html:3 templates/rosetta/pofile.html:13 +msgid "Home" +msgstr "Home" + +#: templates/rosetta/languages.html:3 templates/rosetta/languages.html.py:4 +msgid "Language selection" +msgstr "Sprachwahl" + +#: templates/rosetta/languages.html:14 +msgid "Application" +msgstr "" + +#: templates/rosetta/languages.html:15 +msgid "Progress" +msgstr "Fortschritt" + +#: templates/rosetta/languages.html:16 +msgid "Messages" +msgstr "Texte" + +#: templates/rosetta/languages.html:17 +msgid "Translated" +msgstr "Übersetzt" + +#: templates/rosetta/languages.html:18 templates/rosetta/pofile.html:48 +msgid "Fuzzy" +msgstr "Unscharf" + +#: templates/rosetta/languages.html:19 +msgid "Obsolete" +msgstr "Veraltet" + +#: templates/rosetta/languages.html:20 +msgid "File" +msgstr "Datei" + +#: templates/rosetta/languages.html:41 +msgid "Nothing to translate!" +msgstr "Nichts zu übersetzen!" + +#: templates/rosetta/languages.html:42 +msgid "" +"You haven't specified any languages in your settings file, or haven't yet " +"generated a batch of translation catalogs." +msgstr "" +"Sie haben keine Sprachen in der Einstellungsdatei definiert oder bis jetzt " +"noch keine Übersetzungskataloge generiert." + +# python-format +#: templates/rosetta/languages.html:43 +#, python-format +msgid "" +"Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project." +msgstr "" +"Unter Django's I18N documentation finden " +"Sie eine Anleitung, wie sie Internationalisierung in Ihrem Projekt " +"einrichten." + +#: templates/rosetta/pofile.html:7 +msgid "Pick another file" +msgstr "Wähle eine andere Datei" + +#: templates/rosetta/pofile.html:8 +msgid "Download this catalog" +msgstr "Laden sie diesen Katalog herunter" + +#: templates/rosetta/pofile.html:16 +msgid "Progress: %(percent_translated)s%" +msgstr "Fortschritt: %(percent_translated)s%" + +#: templates/rosetta/pofile.html:17 +msgid "File is read-only: download the file when done editing!" +msgstr "" +"Datei ist schreibgeschützt: Laden Sie die Datei herunter wenn sie mit dem " +"Editieren fertig sind!" + +#: templates/rosetta/pofile.html:19 +msgid "English" +msgstr "Englisch" + +#: templates/rosetta/pofile.html:21 +#, python-format +msgid "Translate into %(rosetta_i18n_lang_name)s" +msgstr "Übersetze in %(rosetta_i18n_lang_name)s" + +#: templates/rosetta/pofile.html:24 +msgid "Display:" +msgstr "Anzeige:" + +#: templates/rosetta/pofile.html:25 +msgid "Untranslated only" +msgstr "Nur unübersetzte" + +#: templates/rosetta/pofile.html:26 +msgid "Translated only" +msgstr "Nur übersetzte" + +#: templates/rosetta/pofile.html:27 +msgid "Fuzzy only" +msgstr "Nur unscharfe" + +#: templates/rosetta/pofile.html:28 +msgid "All" +msgstr "Alle" + +#: templates/rosetta/pofile.html:34 +msgid "Search" +msgstr "Suchen" + +#: templates/rosetta/pofile.html:36 +msgid "Go" +msgstr "Los" + +#: templates/rosetta/pofile.html:45 +msgid "Original" +msgstr "Original" + +#: templates/rosetta/pofile.html:49 +msgid "Occurrences(s)" +msgstr "Gefunden in" + +#: templates/rosetta/pofile.html:73 +msgid "suggest" +msgstr "vorschlagen" + +#: templates/rosetta/pofile.html:84 +#, python-format +msgid "%(more_count)s more" +msgid_plural "%(more_count)s more" +msgstr[0] "%(more_count)s mehr" +msgstr[1] "%(more_count)s mehr" + +#: templates/rosetta/pofile.html:96 +msgid "Save and translate next block" +msgstr "Speichern und nächsten Block übersetzen" + +#: templates/rosetta/pofile.html:100 +msgid "Skip to page:" +msgstr "Zur Seite:" + +#: templates/rosetta/pofile.html:113 +msgid "Displaying:" +msgstr "Anzeigen:" + +#: templates/rosetta/pofile.html:115 +#, python-format +msgid "%(hits)s/%(message_number)s message" +msgid_plural "%(hits)s/%(message_number)s messages" +msgstr[0] "%(hits)s/%(message_number)s Text" +msgstr[1] "%(hits)s/%(message_number)s Texte" + +#~ msgid "Both" +#~ msgstr "Beide" diff --git a/pyweb/rosetta/locale/es/LC_MESSAGES/django.mo b/pyweb/rosetta/locale/es/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..99a6d85037fc59a880b846cbb4bdefbac14248df GIT binary patch literal 2715 zcma)+OKclO7{>=F6ij)Q@_uwuh!RuQi33uDX``lTnnvVd|$98gl4{qT5hx~gCPLlr{orMA4E!n||0N&)9i)8!3BC*NMKExceE=ftv?jDK<%se_ zzEhna$4%=#hMO+R_0zbqOj<9bD~)3hNY{fI(pc%0dW-g@i}KgMsPCT0KPW$x6S`1l z_9$-hjjo4rQy$ppcvHo$=q5(TThciZ%9>7Eb!m%^=L7%8#=)p%tgQJa(J{@%#|_7h zE7y)hr^50Vr9-@%vpO;&;Biwq?u%GNCS>zEjFfA#6DpGFgX2#tMc^47bt*g<&XT+V zBYw6iHHNk1GEgy=9$_bvbLTqQlhZV|VAx61l59!nFhRWB$w>OKGMX)C8E|aHz!4qt z*znj2?IID&5w==)CX%satG=IDE444(xGS=%^0&Cqm?LfK2dhR>I0;`H7{MZk1#jZx z$br#uRi4(h!1%RD>8+wWFmwD295G{#FP5iQ;Jlx-q>cqSba+C{@P@Hm@GwzL z&eDob#yn|rrDJJzYAhmkE`3R7bWCD-+nO^7t;DLtb6X7?h$PIM?#6nAaoYZ?SbLtlwnoTdGZ7w2{9G+Zb5F9fOsvfqSv2rLjf`uck#y z7TwS?_}gn%mQ6j_Fvvz;GYN0P8$A|t*OtC&C>g-D4yPrlbPnurZI>QdG2?dD>0XZSU09bQR=+Kz&j&5aY@^w5q)v>*ikyik5*4;=9CcY>AUV?c!iIvQ+L9We*M;U7wg}PbeeT#S z`dn=rHXm_ndAyQkugjq@EfW|{qLElp;XB>oT0>($p?#22+fo{xiqlJ)By40x*eMxB z#+g1HcfG3-_O{qw`O4s&VR>Kmu0qZvSAjAu0eMQ3iZjv>+jvq3#sY`x<}%e6rh!+PaB*kqR;J>W%2iuf>{Lfr zLHZKx8YaCjL~iBxuD0Mp?}`YN?TZ)U)v0)8D+?Ycq+A{3*9@e~^rZ_Y?BAqoArUqZ zmUjkO;Z8v~(cqHw3;ANlderG{0yBK;7jPYV z)UQZh(-i|La_F5*!F++H&^RBxYdWthbreGGcNywEP&1fj(=!F5elmgBri3Osm$EeB R*`|Zi4B9zUG-;J(e*sQR00jU5 literal 0 HcmV?d00001 diff --git a/pyweb/rosetta/locale/es/LC_MESSAGES/django.po b/pyweb/rosetta/locale/es/LC_MESSAGES/django.po new file mode 100644 index 0000000..c87f67d --- /dev/null +++ b/pyweb/rosetta/locale/es/LC_MESSAGES/django.po @@ -0,0 +1,171 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-21 12:21+0200\n" +"PO-Revision-Date: 2008-11-30 12:12\n" +"Last-Translator: \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Translated-Using: django-rosetta 0.4.RC2\n" + +#: templates/rosetta/languages.html:3 templates/rosetta/pofile.html:13 +msgid "Home" +msgstr "Inicio" + +#: templates/rosetta/languages.html:3 templates/rosetta/languages.html.py:4 +msgid "Language selection" +msgstr "Selección de idioma" + +#: templates/rosetta/languages.html:14 +msgid "Application" +msgstr "" + +#: templates/rosetta/languages.html:15 +msgid "Progress" +msgstr "Progreso" + +#: templates/rosetta/languages.html:16 +msgid "Messages" +msgstr "Mensajes" + +#: templates/rosetta/languages.html:17 +msgid "Translated" +msgstr "Traducido" + +#: templates/rosetta/languages.html:18 templates/rosetta/pofile.html:48 +msgid "Fuzzy" +msgstr "Velloso" + +#: templates/rosetta/languages.html:19 +msgid "Obsolete" +msgstr "Obsoleto" + +#: templates/rosetta/languages.html:20 +msgid "File" +msgstr "Archivo" + +#: templates/rosetta/languages.html:41 +msgid "Nothing to translate!" +msgstr "¡Nada que traducir!" + +#: templates/rosetta/languages.html:42 +msgid "" +"You haven't specified any languages in your settings file, or haven't yet " +"generated a batch of translation catalogs." +msgstr "" +"No has especificado ningún idioma en tu archivo de settings o no has " +"generado todavía un batch para traducción de catálogos." + +#: templates/rosetta/languages.html:43 +#, python-format +msgid "" +"Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project." +msgstr "" +"Por favor visita la Documentación de Django " +"sobre I18N para obtener una guía sobre cómo añadir internacionalización " +"a tu proyecto." + +#: templates/rosetta/pofile.html:7 +msgid "Pick another file" +msgstr "Selecciona otro archivo" + +#: templates/rosetta/pofile.html:8 +msgid "Download this catalog" +msgstr "Descarga este catálogo" + +#: templates/rosetta/pofile.html:16 +msgid "Progress: %(percent_translated)s%" +msgstr "Progreso: %(percent_translated)s%" + +#: templates/rosetta/pofile.html:17 +msgid "File is read-only: download the file when done editing!" +msgstr "" +"El archivo está en modo lectura: ¡Descarga el archivo cuando termines de " +"editarlo!" + +#: templates/rosetta/pofile.html:19 +msgid "English" +msgstr "Inglés" + +#: templates/rosetta/pofile.html:21 +#, python-format +msgid "Translate into %(rosetta_i18n_lang_name)s" +msgstr "Traducir al %(rosetta_i18n_lang_name)s " + +#: templates/rosetta/pofile.html:24 +msgid "Display:" +msgstr "Pantalla:" + +#: templates/rosetta/pofile.html:25 +msgid "Untranslated only" +msgstr "Sin traducir sólo" + +#: templates/rosetta/pofile.html:26 +msgid "Translated only" +msgstr "Traducidos sólo" + +#: templates/rosetta/pofile.html:27 +msgid "Fuzzy only" +msgstr "Vellosos sólo" + +#: templates/rosetta/pofile.html:28 +msgid "All" +msgstr "" + +#: templates/rosetta/pofile.html:34 +msgid "Search" +msgstr "Búsqueda" + +#: templates/rosetta/pofile.html:36 +msgid "Go" +msgstr "Ir" + +#: templates/rosetta/pofile.html:45 +msgid "Original" +msgstr "" + +#: templates/rosetta/pofile.html:49 +msgid "Occurrences(s)" +msgstr "Ocurrencia(s)" + +#: templates/rosetta/pofile.html:73 +msgid "suggest" +msgstr "sugerir" + +#: templates/rosetta/pofile.html:84 +#, python-format +msgid "%(more_count)s more" +msgid_plural "%(more_count)s more" +msgstr[0] "%(more_count)s más" +msgstr[1] "%(more_count)s más" + +#: templates/rosetta/pofile.html:96 +msgid "Save and translate next block" +msgstr "Guardar y traducir siguiente bloque" + +#: templates/rosetta/pofile.html:100 +msgid "Skip to page:" +msgstr "Ir a la página:" + +#: templates/rosetta/pofile.html:113 +msgid "Displaying:" +msgstr "Mostrando:" + +#: templates/rosetta/pofile.html:115 +#, python-format +msgid "%(hits)s/%(message_number)s message" +msgid_plural "%(hits)s/%(message_number)s messages" +msgstr[0] "%(hits)s/%(message_number)s mensaje" +msgstr[1] "%(hits)s/%(message_number)s mensajes" + +#~ msgid "Both" +#~ msgstr "Ambos" diff --git a/pyweb/rosetta/locale/fr/LC_MESSAGES/django.mo b/pyweb/rosetta/locale/fr/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..bb227437ddba6f39675c8817773dff485cdb1e7a GIT binary patch literal 2910 zcma)-O>7%Q6vwBueAG}rT4?$1G$l<8-6Xa^q;4A3O%ocCG*P}(PS#|1yq;z~V`g?! zk_(l%AaUrary{`x2}@K+2#F&H-?(t)#F0Z!2nneOf%v~!+erj%8F}}&GduII!x{yg{$`fK0~ zu+bgA3!XrKA2xdhJPAGmR>4EyC9nvtf#k<^@G0;UknG(8Q}8xOaSUMbDsuBWIE(&u z3WXf3aJVU*6S1u6thp|2(eds8`yX>0CN+(fwa{cbrM2k%=U6pKShdwkR47tqG`px= zD-m0j-ho`%a!Ddt<{f*rj5v1Lz!4qu)bP{_ z?Glm76KrAKnM9_NErelat<<4(!>-5{tcsNu30qX*1{WHOrS%T6#Y74x;dC7%ur?uh z1D$gNgTtycu4|DAYl+euMK>^c@hUtrLypgu#xEm^Fl$Pk`m9Ziib-BKmJ1$dDw2qV zH_SD%=w!;X7FRlzR{O~!QQQ8(uh=q~c;f zLAES5C4#}3^fJJ;{2=A)i3vB@vJ^IKu;mTaA}?AOi&sN$|YVZSIVU~#xR13!IIom zWOQfVcz~(pGB1@XW97n}aB0xXtFaYcjhcuxzfTD2ocH&U&@?A8Jx@rmB1N;pXQ)UU zd}40ye4<8-jVBB9v-8tCk(5Tp3R4EPqp{0Y3!bJp<57H}N}uInLs%sA-0I3qFupU7 zP8szaOzY4@^!@Vjb(I#b^!=1ku?^|}i2xmH;I)M-1^ai^Vh+7x|^&o-33vdAQ>LX(7YkfX4nr0tPI zcbv>1L8K*_r9|#Af;Y4gmhjH!s9W@)RG2>0X_HhL4XH}VJAdbyR_|w$1b_sq3c-;o zVau?YYn5Ls@()0=zHlumID!pOF;S*$PqaE;rqbP0wx${eHE6LX7g=iip0YKWsU(rx zd=rjw+iBN3ZQGCFepm zk2o~Cu43dEMg@JnQRd~FQnG2te=m2t)DGG03m%^Dr+Ha-6K@s?#CeiA)B?_nq>n90 zsux^rQ8?GnMqdGa-l-n$FMpVpdL8r+yU+VF)F9tJb-Tyc=n(V}gm4=&i28&McG@_y zFvB07mqN)Se4E`Y^y&?1>7~r)9IBZ0?6ib~t0DfpdE9Ah94{;), YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Rosetta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-21 12:21+0200\n" +"PO-Revision-Date: 2008-09-22 11:02\n" +"Last-Translator: Admin Admin \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Translated-Using: django-rosetta 0.4.RC2\n" + +#: templates/rosetta/languages.html:3 templates/rosetta/pofile.html:13 +msgid "Home" +msgstr "Accueil" + +#: templates/rosetta/languages.html:3 templates/rosetta/languages.html.py:4 +msgid "Language selection" +msgstr "Sélection de la langue" + +#: templates/rosetta/languages.html:14 +msgid "Application" +msgstr "Application" + +#: templates/rosetta/languages.html:15 +msgid "Progress" +msgstr "Progression" + +#: templates/rosetta/languages.html:16 +msgid "Messages" +msgstr "Messages" + +#: templates/rosetta/languages.html:17 +msgid "Translated" +msgstr "Traduits" + +#: templates/rosetta/languages.html:18 templates/rosetta/pofile.html:48 +msgid "Fuzzy" +msgstr "Flous" + +#: templates/rosetta/languages.html:19 +msgid "Obsolete" +msgstr "Obsolètes" + +#: templates/rosetta/languages.html:20 +msgid "File" +msgstr "Fichier" + +#: templates/rosetta/languages.html:41 +msgid "Nothing to translate!" +msgstr "Rien à Traduire!" + +#: templates/rosetta/languages.html:42 +msgid "" +"You haven't specified any languages in your settings file, or haven't yet " +"generated a batch of translation catalogs." +msgstr "" +"Vous n'avez spécifié aucune langue dans votre fichier de configuration, ou " +"n'avez pas encore généré le catalogue initial de traductions pour votre " +"projet." + +# python-format +#: templates/rosetta/languages.html:43 +#, python-format +msgid "" +"Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project." +msgstr "" +"Veuillez vous référer à la documentation sur " +"l'internationalisation de Django pour un guide sur comment activer et " +"configurer la traduction de votre projet." + +#: templates/rosetta/pofile.html:7 +msgid "Pick another file" +msgstr "Choisir un autre fichier" + +#: templates/rosetta/pofile.html:8 +msgid "Download this catalog" +msgstr "Télécharger ce catalogue" + +#: templates/rosetta/pofile.html:16 +msgid "Progress: %(percent_translated)s%" +msgstr "Progression: %(percent_translated)s%" + +#: templates/rosetta/pofile.html:17 +msgid "File is read-only: download the file when done editing!" +msgstr "" +"Fichier en seule lecture: télécharger le fichier à la fin de l'édition!" + +#: templates/rosetta/pofile.html:19 +msgid "English" +msgstr "Anglais" + +#: templates/rosetta/pofile.html:21 +#, python-format +msgid "Translate into %(rosetta_i18n_lang_name)s" +msgstr "Traduire en %(rosetta_i18n_lang_name)s" + +#: templates/rosetta/pofile.html:24 +msgid "Display:" +msgstr "Afficher:" + +#: templates/rosetta/pofile.html:25 +msgid "Untranslated only" +msgstr "Non-traduits uniquement" + +#: templates/rosetta/pofile.html:26 +msgid "Translated only" +msgstr "Traduits uniquement" + +#: templates/rosetta/pofile.html:27 +msgid "Fuzzy only" +msgstr "Flous uniquement" + +#: templates/rosetta/pofile.html:28 +msgid "All" +msgstr "Tous" + +#: templates/rosetta/pofile.html:34 +msgid "Search" +msgstr "Recherche" + +#: templates/rosetta/pofile.html:36 +msgid "Go" +msgstr "Go" + +#: templates/rosetta/pofile.html:45 +msgid "Original" +msgstr "Original" + +#: templates/rosetta/pofile.html:49 +msgid "Occurrences(s)" +msgstr "Occurrences(s)" + +#: templates/rosetta/pofile.html:73 +msgid "suggest" +msgstr "suggérer" + +#: templates/rosetta/pofile.html:84 +#, python-format +msgid "%(more_count)s more" +msgid_plural "%(more_count)s more" +msgstr[0] "%(more_count)s de plus" +msgstr[1] "%(more_count)s de plus" + +#: templates/rosetta/pofile.html:96 +msgid "Save and translate next block" +msgstr "Sauver et traduire le prochain bloc" + +#: templates/rosetta/pofile.html:100 +msgid "Skip to page:" +msgstr "Passer à la page:" + +#: templates/rosetta/pofile.html:113 +msgid "Displaying:" +msgstr "Affichés:" + +#: templates/rosetta/pofile.html:115 +#, python-format +msgid "%(hits)s/%(message_number)s message" +msgid_plural "%(hits)s/%(message_number)s messages" +msgstr[0] "%(hits)s/%(message_number)s message" +msgstr[1] " %(hits)s/%(message_number)s messages" + +#~ msgid "Both" +#~ msgstr "Les deux" diff --git a/pyweb/rosetta/locale/hu/LC_MESSAGES/django.mo b/pyweb/rosetta/locale/hu/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..4f9fb490d04b853394d9e86535b48e743975aa3c GIT binary patch literal 2275 zcmai!-)me&6vs!ct!}mTN2~Q0oV3I?v^U)i{z$h;Xl;{P+N2>rq&`TTy?1i=W@l%X znb~c39|V1rf)rE`e92=U`cMjj&zHQ3AP6Fe_y-93p!BWyJvY0Xyr{#@{mjgsIdjf; ze*F5}o-YK-E2yuc{)IY<`rRY=pnUkK5Kn*-+z)PmhrtfG54;8L0Y3-d2EPLF6F>CF ze*~XH|7Vc>{0{Q`zx)0Dj|p)A{X^ih;4$zs@J*2Ix4;qbd+;^zPjD}I0E<2i9tOw2 zV_*rK2M>bRLH1V%1K0yO-ao)kk=q0CN%TK~Gv+Pu1@KGoaqw=R_rYoOzXkCV5Afl* z9)iz+`{0!Q9>It6qJIA^kmHyEUji3E1J*&F{}agh{08DD9`?ug;!lp_Ab1LV9c0~? z!Kc7Akn_^u2jE8_$Mp-yTgF;)IfBaLhfp~m_5taN!n$$cc(DydeB9^4TCk2>cpW|$ z93K}*CSF9vQbjD!gPh}_aNMj3?>Cp1`ExPzEiJp%K_fFM+V+OgRwfkcnWtC=sckA| zO{z0r7jv0b#fR{xQ!?Pa^@zA+#k;nt#8qk1woDay zrBxg*R~zCoZUcb<6_a-)FHWH zqe`PETFS*(X>FKcGUi9cvg{}%1LX&alTkMV)wGQpVp&NS*Tr%pYjG4Us8tm!Lra8X z;n`V)7vx%zt44ZjMmE)$-?2<~HIbF>id8dQFxeh?-?piaXw30IzNO-9JyQun>k_-< zt@FsAicEPuY?v?PKShviFtZDxQe~9G7GgHlWQglz*N6E*=fMH<E zqW6^ZFsjnhc3Pz+)v_)`^FGaz=$&@zqZM1F(&Dw1=mJh7?_6{d%T;NjTs{+3%F#rH zDihU-%E>ZDU>Gf_PR34m>?YZ+e1)wp%(Olkh|{OnF@mGN@v z0=&Xqw9;)M^ngu2jf=_rO8?rO4o-mt0Y?W z#UDv=$fN$jpz`<|<4YGNN{hPfq>kpSYkGv*D!P8Ua+bE6)8(@zvE19b=khzgx~p}C zUxfUA+V+GSnSY}L43s#Jo212DzPX{rd0J;ue%IxjzLVcca7K_98{=-`agfv)x(TOn zVhC1g4`w6ciYo5Q+}3TY6RE{QSLseC-_+9g0{n^m>mE*35DS@!JvFny*DlHL25GVp zF{@>#tpm7qo5$N4b8JJ*16iXV*)Df-`@l8$j3UBX&G33#_Ye?CEgSHQnfYej_K02a zN&f#wW$>gliYF!CjI;cH;74Udo!Q?^&{D% zLK`Qm0z1gLd-)%?pNgCuUS8Fgsv~#WHiUr} literal 0 HcmV?d00001 diff --git a/pyweb/rosetta/locale/hu/LC_MESSAGES/django.po b/pyweb/rosetta/locale/hu/LC_MESSAGES/django.po new file mode 100644 index 0000000..4bf066d --- /dev/null +++ b/pyweb/rosetta/locale/hu/LC_MESSAGES/django.po @@ -0,0 +1,165 @@ +# Copyright (C) 2008 +# Gergely Kontra , 2008. +# +msgid "" +msgstr "" +"Project-Id-Version: Rosetta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-21 12:21+0200\n" +"PO-Revision-Date: 2008-10-09 19:08+0100\n" +"Last-Translator: Gergely Kontra \n" +"Language-Team: nomail \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Translated-Using: django-rosetta 0.4.RC2\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: templates/rosetta/languages.html:3 templates/rosetta/pofile.html:13 +msgid "Home" +msgstr "Főoldal" + +#: templates/rosetta/languages.html:3 templates/rosetta/languages.html.py:4 +msgid "Language selection" +msgstr "Nyelvválasztás" + +#: templates/rosetta/languages.html:14 +msgid "Application" +msgstr "" + +#: templates/rosetta/languages.html:15 +msgid "Progress" +msgstr "Állapot" + +#: templates/rosetta/languages.html:16 +msgid "Messages" +msgstr "Üzenet" + +#: templates/rosetta/languages.html:17 +msgid "Translated" +msgstr "Lefordítva" + +#: templates/rosetta/languages.html:18 templates/rosetta/pofile.html:48 +msgid "Fuzzy" +msgstr "" + +#: templates/rosetta/languages.html:19 +msgid "Obsolete" +msgstr "Elavult" + +#: templates/rosetta/languages.html:20 +msgid "File" +msgstr "Fájl" + +#: templates/rosetta/languages.html:41 +msgid "Nothing to translate!" +msgstr "Nincs mit fordítani!" + +#: templates/rosetta/languages.html:42 +msgid "" +"You haven't specified any languages in your settings file, or haven't yet " +"generated a batch of translation catalogs." +msgstr "" +"Nincs beállítva egyetlen nyelv sem van nem hozott létre egy fordítási " +"katalóguskoteget." + +#: templates/rosetta/languages.html:43 +#, python-format +msgid "" +"Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project." +msgstr "" +"Projekted többnyelvűvé alakításához lásd a Django I18N dokumentációt!" + +#: templates/rosetta/pofile.html:7 +msgid "Pick another file" +msgstr "Másik fájl választása" + +#: templates/rosetta/pofile.html:8 +msgid "Download this catalog" +msgstr "Katalógus letöltése" + +#: templates/rosetta/pofile.html:16 +msgid "Progress: %(percent_translated)s%" +msgstr "%(percent_translated)s% kész" + +#: templates/rosetta/pofile.html:17 +msgid "File is read-only: download the file when done editing!" +msgstr "A fájl írásvédett: töltse le a katalógust, ha végzett!" + +#: templates/rosetta/pofile.html:19 +msgid "English" +msgstr "Angol" + +#: templates/rosetta/pofile.html:21 +#, python-format +msgid "Translate into %(rosetta_i18n_lang_name)s" +msgstr "Fordítsa %(rosetta_i18n_lang_name)s nyelvre" + +#: templates/rosetta/pofile.html:24 +msgid "Display:" +msgstr "Szűrés:" + +#: templates/rosetta/pofile.html:25 +msgid "Untranslated only" +msgstr "Fordításra vár" + +#: templates/rosetta/pofile.html:26 +msgid "Translated only" +msgstr "Lefordított" + +#: templates/rosetta/pofile.html:27 +msgid "Fuzzy only" +msgstr "" + +#: templates/rosetta/pofile.html:28 +msgid "All" +msgstr "" + +#: templates/rosetta/pofile.html:34 +msgid "Search" +msgstr "Keresés" + +#: templates/rosetta/pofile.html:36 +msgid "Go" +msgstr "Keress" + +#: templates/rosetta/pofile.html:45 +msgid "Original" +msgstr "" + +#: templates/rosetta/pofile.html:49 +msgid "Occurrences(s)" +msgstr "Előfordulások" + +#: templates/rosetta/pofile.html:73 +msgid "suggest" +msgstr "ajánl" + +#: templates/rosetta/pofile.html:84 +#, fuzzy, python-format +msgid "%(more_count)s more" +msgid_plural "%(more_count)s more" +msgstr[0] "még %(more_count)s" + +#: templates/rosetta/pofile.html:96 +msgid "Save and translate next block" +msgstr "Mentés" + +#: templates/rosetta/pofile.html:100 +msgid "Skip to page:" +msgstr "Ugorj erre az oldalra:" + +#: templates/rosetta/pofile.html:113 +msgid "Displaying:" +msgstr "Szűrés:" + +#: templates/rosetta/pofile.html:115 +#, fuzzy, python-format +msgid "%(hits)s/%(message_number)s message" +msgid_plural "%(hits)s/%(message_number)s messages" +msgstr[0] "%(hits)s/%(message_number)s üzenet" + +#~ msgid "Both" +#~ msgstr "Minden" diff --git a/pyweb/rosetta/locale/it/LC_MESSAGES/django.mo b/pyweb/rosetta/locale/it/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..4f4724161cf0a82dd3fcfff9a8852e07b6fda2ad GIT binary patch literal 2710 zcma)-J#QRE7{><)gdBN+5Z*#a9!H$)Q*yS?P0Zm~b`m==@|$8OQYbjh?T+`xo|`$% z?An|qL0t)`m?%vr23K`w*Z)bL1p11wqZ>Ntu z6lf#3&f$9Z86hUX%g^G5_87bc{sE4HQ_l&3pZE~Bm%xv}7s2haAHdhp{}en5J_L_| zUxQb`Z@~)qE67JYD&Ic_Pow`A$ougk-sc#|{R`kpaIEZK0bfCX4txOKF2{cd*_S`T zcfb?R3-JPY2|NK#fi-XrWIMLOQ(y-2exHFU_yx%JAIIXOh{+l71N6^f@I07+m?Az0 zkAwF?{KS{I9Rt4s+5Yd#@t;7LBz^|xz+XT<{}h~q%i=7^cAf`c2dg0OGXrv57D4>P zJ=}O*8|3$0@C|Se`~iFbvOU-EvI?%1%s?C|z5>sH-+`CGA3-b;k3f#k-yp}~AMg|K zBo4!)xDO%>;$>W%cW!(x`^1fF=WPB|_`zqeoxGOw!LeY!295B*_HgXEv5(x?25#&F z*9Yg28|R+w8Z?gC+hyl1@Iv{_zPyQxbHw?16<6M>V;!A_T9~MgbyWy5Q7xNw+sfAh zl>_1_<^)XYIDzO$tnfJ;@DvX7i zSo1p3RvNLcqaBhKipQMm=^-Xwkv4;@Ik5z-P@#|sk!u0!0w1j-e79+a zEhrpbm`{<$NR$iYB38zXLNoG1N5lp%++yVrceTXk`~sD4R6Ze}E(xD6YETr~!7*6P zc*9t7Va2QyL*;O+9FCP^A0kq!hJr5&5~twHATot`+;td6`H7 z6eb4PGFoZ_kFYlE%hG&Jh2-Sw0ujLR&=;M-^pFvX4#DmA5PA+XbT#*f*J|R~2>dSR z1z$f@1@UzU`jTgDAU522lFpc2KA_wm(czu3WeB?Ka=D3|xDJiNEU_-}cZDf=AfP(X z-CTF_K+`V1P{+%kEIqMC-ijDvygz{$SOKe9mKyB9sDCXXkZ8&ry}j>8bl_K o!!TNTh@d^h+Z8+Hm97T*<2cdf{~OHZx{}!CP|1|~gQP3*FS`fhPyhe` literal 0 HcmV?d00001 diff --git a/pyweb/rosetta/locale/it/LC_MESSAGES/django.po b/pyweb/rosetta/locale/it/LC_MESSAGES/django.po new file mode 100644 index 0000000..684aac3 --- /dev/null +++ b/pyweb/rosetta/locale/it/LC_MESSAGES/django.po @@ -0,0 +1,168 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Rosetta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-21 12:21+0200\n" +"Last-Translator: Marco Bonetti \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: templates/rosetta/languages.html:3 templates/rosetta/pofile.html:13 +msgid "Home" +msgstr "Inizio" + +#: templates/rosetta/languages.html:3 templates/rosetta/languages.html.py:4 +msgid "Language selection" +msgstr "Selezione della lingua" + +#: templates/rosetta/languages.html:14 +msgid "Application" +msgstr "Applicazione" + +#: templates/rosetta/languages.html:15 +msgid "Progress" +msgstr "Progressione" + +#: templates/rosetta/languages.html:16 +msgid "Messages" +msgstr "Messaggio" + +#: templates/rosetta/languages.html:17 +msgid "Translated" +msgstr "Tradotto" + +#: templates/rosetta/languages.html:18 templates/rosetta/pofile.html:48 +msgid "Fuzzy" +msgstr "" + +#: templates/rosetta/languages.html:19 +msgid "Obsolete" +msgstr "Obsoleto" + +#: templates/rosetta/languages.html:20 +msgid "File" +msgstr "File" + +#: templates/rosetta/languages.html:41 +msgid "Nothing to translate!" +msgstr "Nulla da tradurre!" + +#: templates/rosetta/languages.html:42 +msgid "" +"You haven't specified any languages in your settings file, or haven't yet " +"generated a batch of translation catalogs." +msgstr "" +"Non avete specificato nessuna lingua nelle vostre impostazioni, o non avete " +"ancore generato un catalogo iniziale da tradurre." + +# python-format +#: templates/rosetta/languages.html:43 +#, python-format +msgid "" +"Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project." +msgstr "" +"Vogliate riferirvi alla documentazione " +"sull'internazionalizzazione di Django per una giuda su come impostare le " +"traduzioni per il vostro progetto." + +#: templates/rosetta/pofile.html:7 +msgid "Pick another file" +msgstr "Scegliere un altro file" + +#: templates/rosetta/pofile.html:8 +msgid "Download this catalog" +msgstr "Scaricare il catalogo" + +#: templates/rosetta/pofile.html:16 +msgid "Progress: %(percent_translated)s%" +msgstr "Progressione: %(percent_translated)s%" + +#: templates/rosetta/pofile.html:17 +msgid "File is read-only: download the file when done editing!" +msgstr "file in solo lettura: scaricare il file alla fine dell'edizione!" + +#: templates/rosetta/pofile.html:19 +msgid "English" +msgstr "Inglese" + +#: templates/rosetta/pofile.html:21 +#, python-format +msgid "Translate into %(rosetta_i18n_lang_name)s" +msgstr "Tradurre verso il %(rosetta_i18n_lang_name)s" + +#: templates/rosetta/pofile.html:24 +msgid "Display:" +msgstr "Mostra:" + +#: templates/rosetta/pofile.html:25 +msgid "Untranslated only" +msgstr "Solo non tradotti" + +#: templates/rosetta/pofile.html:26 +msgid "Translated only" +msgstr "Solo tradotti" + +#: templates/rosetta/pofile.html:27 +msgid "Fuzzy only" +msgstr "Solo fuzzy" + +#: templates/rosetta/pofile.html:28 +msgid "All" +msgstr "Tutti" + +#: templates/rosetta/pofile.html:34 +msgid "Search" +msgstr "Cercare" + +#: templates/rosetta/pofile.html:36 +msgid "Go" +msgstr "Via" + +#: templates/rosetta/pofile.html:45 +msgid "Original" +msgstr "Originale" + +#: templates/rosetta/pofile.html:49 +msgid "Occurrences(s)" +msgstr "Occorrenze" + +#: templates/rosetta/pofile.html:73 +msgid "suggest" +msgstr "suggerire" + +#: templates/rosetta/pofile.html:84 +#, python-format +msgid "%(more_count)s more" +msgid_plural "%(more_count)s more" +msgstr[0] "un altro" +msgstr[1] "ancora %(more_count)s" + +#: templates/rosetta/pofile.html:96 +msgid "Save and translate next block" +msgstr "Salvare e tradurre il prossimo blocco" + +#: templates/rosetta/pofile.html:100 +msgid "Skip to page:" +msgstr "Passare alla pagina:" + +#: templates/rosetta/pofile.html:113 +msgid "Displaying:" +msgstr "Mostrato:" + +#: templates/rosetta/pofile.html:115 +#, python-format +msgid "%(hits)s/%(message_number)s message" +msgid_plural "%(hits)s/%(message_number)s messages" +msgstr[0] "%(hits)s/%(message_number)s messaggio" +msgstr[1] "%(hits)s/%(message_number)s messaggi" + +#~ msgid "Both" +#~ msgstr "Entrambi" diff --git a/pyweb/rosetta/locale/nl/LC_MESSAGES/django.mo b/pyweb/rosetta/locale/nl/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..372aa82a2e33d2b6eb36d3749614d81b0407aff3 GIT binary patch literal 2433 zcmbW2O>7%Q6vqcBUj|wzAEkv#lSol*U=ur1+th6$Xq&b{O%pY4D=L8*@4l?39?w`i zvktBhSB`K1j!1CiRyc9u05>>r;RpxLy@5Dzf&bgJoeGIkG4kwhKHj`}@6F8fFZ=g= zEKpuReG&C{)H&22?!yP=?fZqe04nei@C)!U@GJ0H@Eh=9@F#E&_%nDM{1wDc9D1M} zKMd|ie->mtM?qe{GVZs)z39IQJ_Q=^1Mt1^{9Y)ZLH_`F7(4+!1YQH50N(;@paCo3 zC*VHtGm!P&0t5IhsNvhvgF>vK|2dSfp4(&o1|C5F&vAc0oMZnE;&Tn00okt+$osqt zJ`TPQJ_>#WvY(%hc?;xteFt)ke*}l%ZII<-1Y;KLgY4gjAlvgL$aa4Xz65>`;wS#V zhyD5s1kAs5&J9Vs$Cs?%`ePV`{cb!scrLqhq9WN{*4Giu6YcNNKP2+5r; zSqxi}l;{A}Gvd4x7hIpjMP<_*W=l_o;-H-s>!l-JTyoggrZPAgGG)C{fo8-;$2&uT z#6}$FSw=P{U-dPyspFnh7HcRgwiTO(lqZ7OwZ_sV*c#`3vO%#yrxw(T+;*8%GR<{D(plMcJFL-DkoiDr8z{4durm5) z(I{4oT%O56=5D~Xd9j(fG=p=~MpMpJ2b9IwsXg^DsrfmvrG^A&5c!GY($YIYc8rUA zVvAH3cg0pu57>$U;@1?dsU*yC(40A#7gW3O)xf>BReh@YUCHE*CcH8uam7wIOv;fr zTrRt?#vTdM4=C2#ni7~clB|-C&clCMc*^_Xz<8?ERJZXuso zbQaq*yeE>U;)1WHeWlHO?D{K}$yJV8r279YzP`4;y6atIzFs-waE~lD9SvZ8 zz6P zCt73M#dVEa@qaQ56$z$VMy4i*u)8!tTV$O+ZZuL3O#DZh@jNkKxEWGB#ogAwrl9%nIDWeeOQ;4YsY_1xktB1G`x6T F{0;Jhq?P~x literal 0 HcmV?d00001 diff --git a/pyweb/rosetta/locale/nl/LC_MESSAGES/django.po b/pyweb/rosetta/locale/nl/LC_MESSAGES/django.po new file mode 100644 index 0000000..f4f9aa8 --- /dev/null +++ b/pyweb/rosetta/locale/nl/LC_MESSAGES/django.po @@ -0,0 +1,171 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2008 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the rosetta package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Rosetta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-21 12:21+0200\n" +"PO-Revision-Date: 2008-06-05 17:06+0200\n" +"Last-Translator: Joost Cassee \n" +"Language-Team: Joost Cassee \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: templates/rosetta/languages.html:3 templates/rosetta/pofile.html:13 +msgid "Home" +msgstr "Voorpagina" + +#: templates/rosetta/languages.html:3 templates/rosetta/languages.html.py:4 +msgid "Language selection" +msgstr "Taalselectie" + +#: templates/rosetta/languages.html:14 +msgid "Application" +msgstr "" + +#: templates/rosetta/languages.html:15 +msgid "Progress" +msgstr "Voortgang" + +#: templates/rosetta/languages.html:16 +msgid "Messages" +msgstr "Berichten" + +#: templates/rosetta/languages.html:17 +msgid "Translated" +msgstr "Vertaald" + +#: templates/rosetta/languages.html:18 templates/rosetta/pofile.html:48 +msgid "Fuzzy" +msgstr "" + +#: templates/rosetta/languages.html:19 +msgid "Obsolete" +msgstr "Niet meer gebruikt" + +#: templates/rosetta/languages.html:20 +msgid "File" +msgstr "Bestand" + +#: templates/rosetta/languages.html:41 +msgid "Nothing to translate!" +msgstr "Niets te vertalen!" + +#: templates/rosetta/languages.html:42 +msgid "" +"You haven't specified any languages in your settings file, or haven't yet " +"generated a batch of translation catalogs." +msgstr "" +"U heeft geen talen gespecificeerd in het bestand settings.py of nog geen " +"catalogus gegenereerd." + +# python-format +#: templates/rosetta/languages.html:43 +#, python-format +msgid "" +"Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project." +msgstr "" +"Zie Django's I18N documentatie (Engels) " +"voor meer informatie over internationalisatie." + +#: templates/rosetta/pofile.html:7 +msgid "Pick another file" +msgstr "Selecteer een ander bestand" + +#: templates/rosetta/pofile.html:8 +msgid "Download this catalog" +msgstr "Download deze catalogus" + +#: templates/rosetta/pofile.html:16 +msgid "Progress: %(percent_translated)s%" +msgstr "Voortgang: %(percent_translated)s%" + +#: templates/rosetta/pofile.html:17 +msgid "File is read-only: download the file when done editing!" +msgstr "" +"Dit is bestand is alleen-lezen; download dit bestand wanneer u klaar bent " +"met bewerken!" + +#: templates/rosetta/pofile.html:19 +msgid "English" +msgstr "Engels" + +#: templates/rosetta/pofile.html:21 +#, python-format +msgid "Translate into %(rosetta_i18n_lang_name)s" +msgstr "Vertalen in het %(rosetta_i18n_lang_name)s" + +#: templates/rosetta/pofile.html:24 +msgid "Display:" +msgstr "Beeld:" + +#: templates/rosetta/pofile.html:25 +msgid "Untranslated only" +msgstr "Alleen onvertaald" + +#: templates/rosetta/pofile.html:26 +msgid "Translated only" +msgstr "Alleen vertaald" + +#: templates/rosetta/pofile.html:27 +msgid "Fuzzy only" +msgstr "" + +#: templates/rosetta/pofile.html:28 +msgid "All" +msgstr "" + +#: templates/rosetta/pofile.html:34 +msgid "Search" +msgstr "Zoeken" + +#: templates/rosetta/pofile.html:36 +msgid "Go" +msgstr "Ga" + +#: templates/rosetta/pofile.html:45 +msgid "Original" +msgstr "" + +#: templates/rosetta/pofile.html:49 +msgid "Occurrences(s)" +msgstr "Gevonden in" + +#: templates/rosetta/pofile.html:73 +msgid "suggest" +msgstr "" + +#: templates/rosetta/pofile.html:84 +#, python-format +msgid "%(more_count)s more" +msgid_plural "%(more_count)s more" +msgstr[0] "" +msgstr[1] "" + +#: templates/rosetta/pofile.html:96 +msgid "Save and translate next block" +msgstr "Opslaan en volgende blok vertalen" + +#: templates/rosetta/pofile.html:100 +msgid "Skip to page:" +msgstr "Snel naar pagina:" + +#: templates/rosetta/pofile.html:113 +msgid "Displaying:" +msgstr "Tonen:" + +#: templates/rosetta/pofile.html:115 +#, python-format +msgid "%(hits)s/%(message_number)s message" +msgid_plural "%(hits)s/%(message_number)s messages" +msgstr[0] "%(hits)s/%(message_number)s bericht" +msgstr[1] "%(hits)s/%(message_number)s berichten" + +#~ msgid "Both" +#~ msgstr "Beide" diff --git a/pyweb/rosetta/locale/pl/LC_MESSAGES/django.mo b/pyweb/rosetta/locale/pl/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..931aedd71371d706dc76b4de5b7fa6160046f1f6 GIT binary patch literal 2640 zcma)-&yN&E6vsA0$2u;A6&BdIyR7>|(Sw_s?%J7}>8WbF zsu_DuhCnzOAyES%@!~-bCLV|$i1EVAzo3Z+Zyq$plNWD(U(d`g7}wBA&!?;Uy;tv7 zzxieFj!y-y=W#!Wd&hl3jDUZDd|lZl#2N4^co6& zVemVU{cnQ<;Gf_l;NKwI+jYMX9^4PIzgNIT#Ci=}!1^~B3&2UdWc_uJ{dpgJ9Q+X6 z1%3j;r1%`12EXX7f9<{h9b~<~K(@0T!M*_Q0ol({ko}qh*{?b9OYl7qDq<%N;W+nz z1df3m=bIq=aSl8L#vt3d267(10-pwd02A;hknNp;69}{Lnd`n)W06>J#c;d7uV>S-h%s}f1#Y>DctNEUr*p>|HaU7 zReLw$jtmVqlykD8)=btYt8~OsZ{uEM9E2J+RcoQmjAvae{&Vl7c1bMrlIT5XQ^B)s zn%K&Sd{sLNrI)d-h#6CfwX2F#I#$IG;bp316j&4IC5kq+6s<#unpI`6Z4{|Udzc;+ zr>!_+8%oScQ^^n>ITfqWYiq=OH()0gEY39*@|JumjfUYzqX&kD_4uS&i)^?SYf~R_2acVr!4Z4V z(d_u-0(=d#hB98VLsLiOFR_ zYHJ8>R4k^pk|MZ`hY}49Cn^nb(%MFZ(TE!o%ksQJFvxsAa5CxxPvzK#b+N2u8dk+} zT_@~Cg8Y@l%7!G|v9O$4xaZ|s5o?U_){JbZ5w|HB-SLR1;#{nnjRT|Z&O0`vD!efV zJ-I}MdR?msuI0ogxpWTkQxPejhl05x{f7xD>ucsnR7Dw;qJ+?IO$Q|BlrZhd5yxVOp(i@t1G91$xS&fFj_g7F`WUXp z(au4y1!!#a#nGh`69f44x1K9?+sKTrOMh=tw{JEfc-M4k>h|?e)wbGxJMY|RYUSgS z*m#siqjwi=8To7>35MW6F=nPsMXT7=HNInAFMgr%YYk3JU*T2Vui z(IKCbq%Gw;7qW&7TgqrTh^}nG51F=P=YoPA=i8Ui4~S$~jsQH3r-#)v}5t*kC< zMW$*TIr8XyY7PEiID2=f(bj{C?vlmdhgc~}e`iHDcai>ozu-b9HsUgMZcyiY8JQeo zr(1ILFExt-N$h1PD0;JV@i4_%8MVj1R$fdjG*4F_&DTN;^c$4*5mrAGs1|cerCCk< E12t;=l>h($ literal 0 HcmV?d00001 diff --git a/pyweb/rosetta/locale/pl/LC_MESSAGES/django.po b/pyweb/rosetta/locale/pl/LC_MESSAGES/django.po new file mode 100644 index 0000000..a268433 --- /dev/null +++ b/pyweb/rosetta/locale/pl/LC_MESSAGES/django.po @@ -0,0 +1,170 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Rosetta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-21 12:21+0200\n" +"PO-Revision-Date: 2008-09-12 12:16\n" +"Last-Translator: \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Translated-Using: django-rosetta 0.4.RC2\n" + +#: templates/rosetta/languages.html:3 templates/rosetta/pofile.html:13 +msgid "Home" +msgstr "Początek" + +#: templates/rosetta/languages.html:3 templates/rosetta/languages.html.py:4 +msgid "Language selection" +msgstr "Wybór języka" + +#: templates/rosetta/languages.html:14 +msgid "Application" +msgstr "" + +#: templates/rosetta/languages.html:15 +msgid "Progress" +msgstr "Postęp" + +#: templates/rosetta/languages.html:16 +msgid "Messages" +msgstr "Komunikaty" + +#: templates/rosetta/languages.html:17 +msgid "Translated" +msgstr "Przetłumaczone" + +#: templates/rosetta/languages.html:18 templates/rosetta/pofile.html:48 +msgid "Fuzzy" +msgstr "" + +#: templates/rosetta/languages.html:19 +msgid "Obsolete" +msgstr "Przestarzałe" + +#: templates/rosetta/languages.html:20 +msgid "File" +msgstr "Plik" + +#: templates/rosetta/languages.html:41 +msgid "Nothing to translate!" +msgstr "Nie ma nic do przetłumaczenia!" + +#: templates/rosetta/languages.html:42 +msgid "" +"You haven't specified any languages in your settings file, or haven't yet " +"generated a batch of translation catalogs." +msgstr "" +"Nie podałeś żadnych języków w plikach ustawień, lub nie wygenerowałeś " +"jeszcze katalogów do tłumaczeń." + +# python-format +#: templates/rosetta/languages.html:43 +#, python-format +msgid "" +"Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project." +msgstr "" +"Sprawdź pomoc dotyczącą internacjonalizacji " +"Django I18N , aby znaleźć dokumentację na temat internacjonalizacji " +"twojego projektu." + +#: templates/rosetta/pofile.html:7 +msgid "Pick another file" +msgstr "Wybierz inny plik" + +#: templates/rosetta/pofile.html:8 +msgid "Download this catalog" +msgstr "Pobierz ten katalog" + +#: templates/rosetta/pofile.html:16 +msgid "Progress: %(percent_translated)s%" +msgstr "Postęp: %(percent_translated)s %" + +#: templates/rosetta/pofile.html:17 +msgid "File is read-only: download the file when done editing!" +msgstr "Plik jest tylko do odczytu: pobierz go kiedy skończysz edytować" + +#: templates/rosetta/pofile.html:19 +msgid "English" +msgstr "Angielski" + +#: templates/rosetta/pofile.html:21 +#, python-format +msgid "Translate into %(rosetta_i18n_lang_name)s" +msgstr "Przetłumacz na %(rosetta_i18n_lang_name)s " + +#: templates/rosetta/pofile.html:24 +msgid "Display:" +msgstr "Wyświetl:" + +#: templates/rosetta/pofile.html:25 +msgid "Untranslated only" +msgstr "Tylko nieprzetłumaczone" + +#: templates/rosetta/pofile.html:26 +msgid "Translated only" +msgstr "Tylko przetłumaczone" + +#: templates/rosetta/pofile.html:27 +msgid "Fuzzy only" +msgstr "" + +#: templates/rosetta/pofile.html:28 +msgid "All" +msgstr "" + +#: templates/rosetta/pofile.html:34 +msgid "Search" +msgstr "Szukaj" + +#: templates/rosetta/pofile.html:36 +msgid "Go" +msgstr "Idź" + +#: templates/rosetta/pofile.html:45 +msgid "Original" +msgstr "" + +#: templates/rosetta/pofile.html:49 +msgid "Occurrences(s)" +msgstr "Wystąpienie(a)" + +#: templates/rosetta/pofile.html:73 +msgid "suggest" +msgstr "sugeruj" + +#: templates/rosetta/pofile.html:84 +#, python-format +msgid "%(more_count)s more" +msgid_plural "%(more_count)s more" +msgstr[0] "%(more_count)s więcej" +msgstr[1] "%(more_count)s więcej" + +#: templates/rosetta/pofile.html:96 +msgid "Save and translate next block" +msgstr "Zapisz i tłumacz następny blok" + +#: templates/rosetta/pofile.html:100 +msgid "Skip to page:" +msgstr "Przejdź do strony:" + +#: templates/rosetta/pofile.html:113 +msgid "Displaying:" +msgstr "Wyświetlanie:" + +#: templates/rosetta/pofile.html:115 +#, python-format +msgid "%(hits)s/%(message_number)s message" +msgid_plural "%(hits)s/%(message_number)s messages" +msgstr[0] "%(hits)s/%(message_number)s komunikat" +msgstr[1] "%(hits)s/%(message_number)s komunikatów" + +#~ msgid "Both" +#~ msgstr "Oba" diff --git a/pyweb/rosetta/locale/ru/LC_MESSAGES/django.mo b/pyweb/rosetta/locale/ru/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..b13e00704f44ac0b97e15d32dfce21acc6336001 GIT binary patch literal 2088 zcmb7^OKclO7{>>i0yR*eyd{t(fQv1(shta9DOE$0rj?u~Y8(zoDB7&2_L9x4wX-3l z5>g&5Eu!Fp1Q#AvfnJc1(j+EMLKBV%E;DBk;=l>17cPh!|8LiJ+6oFxGW(nP=6la1 zKkw=IfMGm>`55L;m}$(9Z@~v6cPnE@z&v;dcoMu5TmT;gYvAqRC9nhh3Vaq^0`bd! zYs#;Jd$9iV1IbaoqdO4`oB;QN3*ZCbmmuY}1)c)G1MdO{5tR5cNcLrr>UaYr zyYt|q;3e=WaH}c*6|}Jb6YK+@Mw2K{AAAy=2D`wIK=S)N_yqV1NPc!88M*@M4Gqc} zN9=w~xQuh^0BKM^Xgq|8a<3Z{lkSTK^@Rr2NdqOuV;857mLOTk6Si{QGG4Fv2+FezBU zk>x3*&6V(l8+n0bgGnKZ4UMb77m;8?t~(WmLb^g_RF(~U?gV#a5LHAN2VlctP!3_% zUf4XHsfy4QG8&6QM=IZmL@BG%Y{Yp@z!){P#9WHkBR=j2?gSeVPUu$H$b?trQNXLn z%x1;5rY9jxXTm^;6e7~g4!KyD*&?QB50P4vtSViGX+Pu(vY+$r^ zpr7wA6b|}cR}hvDqy~=;_HQSe@5-eP1u{Z|t>R1-iA3n)KD;4MKF{5X6QV^gj1~`D zJ==QJ#}gv7`lTC`=!Nl~aW6{U^o5!^y@{X8<}F>H%gnnA-|~Cp>rnD3ah=HY7dT(j8|?*; zBX5{pP8t zJ~wl4y%+~tLga=yP1X>Sh`NODJoYuNmzsWY689MO#$_$T?OMAiG#-~pS3wC-L$6Rq ze>6*?$6k@!EV~fneV-{Ta}D4rcCORgi35uimJ( G$o>Mij3T4} literal 0 HcmV?d00001 diff --git a/pyweb/rosetta/locale/ru/LC_MESSAGES/django.po b/pyweb/rosetta/locale/ru/LC_MESSAGES/django.po new file mode 100644 index 0000000..b59254d --- /dev/null +++ b/pyweb/rosetta/locale/ru/LC_MESSAGES/django.po @@ -0,0 +1,163 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Rosetta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-21 12:21+0200\n" +"Last-Translator: Nazar Leush \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: templates/rosetta/languages.html:3 templates/rosetta/pofile.html:13 +msgid "Home" +msgstr "Начало" + +#: templates/rosetta/languages.html:3 templates/rosetta/languages.html.py:4 +msgid "Language selection" +msgstr "Выбор языка" + +#: templates/rosetta/languages.html:14 +msgid "Application" +msgstr "" + +#: templates/rosetta/languages.html:15 +msgid "Progress" +msgstr "Обработано" + +#: templates/rosetta/languages.html:16 +msgid "Messages" +msgstr "Сообщений" + +#: templates/rosetta/languages.html:17 +msgid "Translated" +msgstr "С переводом" + +#: templates/rosetta/languages.html:18 templates/rosetta/pofile.html:48 +msgid "Fuzzy" +msgstr "" + +#: templates/rosetta/languages.html:19 +msgid "Obsolete" +msgstr "Устаревших" + +#: templates/rosetta/languages.html:20 +msgid "File" +msgstr "Файл" + +#: templates/rosetta/languages.html:41 +msgid "Nothing to translate!" +msgstr "" + +#: templates/rosetta/languages.html:42 +msgid "" +"You haven't specified any languages in your settings file, or haven't yet " +"generated a batch of translation catalogs." +msgstr "" + +#: templates/rosetta/languages.html:43 +#, python-format +msgid "" +"Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project." +msgstr "" + +#: templates/rosetta/pofile.html:7 +msgid "Pick another file" +msgstr "Выбрать другой файл" + +#: templates/rosetta/pofile.html:8 +msgid "Download this catalog" +msgstr "Скачать этот каталог" + +#: templates/rosetta/pofile.html:16 +msgid "Progress: %(percent_translated)s%" +msgstr "Обработано: %(percent_translated)s%" + +#: templates/rosetta/pofile.html:17 +msgid "File is read-only: download the file when done editing!" +msgstr "" +"Файл только для чтения: загрузите файл после завершения редактирования!" + +#: templates/rosetta/pofile.html:19 +msgid "English" +msgstr "Английский" + +#: templates/rosetta/pofile.html:21 +#, python-format +msgid "Translate into %(rosetta_i18n_lang_name)s" +msgstr "Перевод на %(rosetta_i18n_lang_name)s" + +#: templates/rosetta/pofile.html:24 +msgid "Display:" +msgstr "Отображать:" + +#: templates/rosetta/pofile.html:25 +msgid "Untranslated only" +msgstr "Только без перевода" + +#: templates/rosetta/pofile.html:26 +msgid "Translated only" +msgstr "Только с переводом" + +#: templates/rosetta/pofile.html:27 +msgid "Fuzzy only" +msgstr "" + +#: templates/rosetta/pofile.html:28 +msgid "All" +msgstr "" + +#: templates/rosetta/pofile.html:34 +msgid "Search" +msgstr "Поиск" + +#: templates/rosetta/pofile.html:36 +msgid "Go" +msgstr "Вперёд" + +#: templates/rosetta/pofile.html:45 +msgid "Original" +msgstr "" + +#: templates/rosetta/pofile.html:49 +msgid "Occurrences(s)" +msgstr "Встречается в" + +#: templates/rosetta/pofile.html:73 +msgid "suggest" +msgstr "" + +#: templates/rosetta/pofile.html:84 +#, python-format +msgid "%(more_count)s more" +msgid_plural "%(more_count)s more" +msgstr[0] "" +msgstr[1] "" + +#: templates/rosetta/pofile.html:96 +msgid "Save and translate next block" +msgstr "Сохранить и перевести следующий блок" + +#: templates/rosetta/pofile.html:100 +msgid "Skip to page:" +msgstr "Перейти к странице:" + +#: templates/rosetta/pofile.html:113 +msgid "Displaying:" +msgstr "Отображение:" + +#: templates/rosetta/pofile.html:115 +#, python-format +msgid "%(hits)s/%(message_number)s message" +msgid_plural "%(hits)s/%(message_number)s messages" +msgstr[0] "%(hits)s/%(message_number)s сообщение" +msgstr[1] "%(hits)s/%(message_number)s сообщений" + +#~ msgid "Both" +#~ msgstr "Все" diff --git a/pyweb/rosetta/locale/uk/LC_MESSAGES/django.mo b/pyweb/rosetta/locale/uk/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..568367f1e005a47928c3a23184a501fc4e88ce28 GIT binary patch literal 2117 zcmb7^O>7%Q6vqc>ff{I`d=w-qO{h#`l}+tj2-{LMG-+DNX`;sAYHik2d&y?j+Sw3N zF8Sai5|IK`2^XYF2)H5Tqk$yGN$*@{#0gPx;E2=<7lg!t|J${lq?8IqUH@j^&b;@3 z|C#ic!}~sE7|-K*5zlQrX*{1lfFF$PgN$7ObKs-kRq!!z7JL?503QLr0{4O6fUklp zApWu68u2^eVZ8qiQl9+}B|Hco#QPEODe&b+ybEl@dpCF#bis$gY48bf4$OdyU<$ki z9s+*=DbLT~0rYSOEaUwTh&uun_cQhaI03!_egZxNZh@rhM{owb4L%MQQIz!g;M3r{ z;B(*tNc+A9NnZ_o3H%A9KK}wwfQMjC4|obBol{^M{0Pi~%OK_Z6+8z12_6TJLJS=N z)uut(@hR4T)Uh`5n+EwogYux=J%eh}dC?$WXi%Rt&|*9e;Fo$K-Q;0&(D^=zhwcWB zEg9+diWjMjI+<=C6G}N{QIz9jBO=Tw-UzV&utu>SPgQ+q(r!*XS;jn=kbdBlcvSHe zcb&-bgEH%tW#3a3cHZ+v{KN4v6i&$sq(5o%(#|fyuV4|Ms0fL$6kL?N2&vmxU%)N| zV}j)!SssUMu7oe#$O|OvPa08dU_=GJhy)vO-SIFK(iN&*W!RwSj&er^QALDt0X7&0 z!SzJIaQH6S@^PH0o7( z6!0pP*{sl7=}83B?O~uq6gfpN*CmTSIw(qKOk~u~%F?bWCtKLCY!xge5r}>ZEn62$ z)|(ua@Jl}n( zZ@9a!m!Hn(&-z|R5SGuR`Y-nP?g-6wWK-t?8NpzyFj<9=2riz)9rENU?pB--7QH@P zIB#|BtRo+4 zn<>4dztu}-Mz7odj5liF%V$`(f~Ss^v}2uiaPt9VY;e69XIO%&ExpS0$B?$FYbdf| zrp-KkX8KF)+t9Vvgqs;GsKuYxIohh31#Ui!GoudmW^?`B-nyu|#?5<4Dz3N9qM432 zHWsd#DKpo!hNHVRBwo_1W;RhzS=-Pj+{9A)%Jg+I6jD|ao!9ibUPj(24x3@QUT69S zO|WE__hchXL4Pm=RnZEhzmK4qr67gS&62r}`8*;ET(3}N$`02P{}v%=4xx=!Q%$RP zI@!8M=->aYGef6e?7kCwWTP^!qglLbO&!sDulpNS$~-{; literal 0 HcmV?d00001 diff --git a/pyweb/rosetta/locale/uk/LC_MESSAGES/django.po b/pyweb/rosetta/locale/uk/LC_MESSAGES/django.po new file mode 100644 index 0000000..637c628 --- /dev/null +++ b/pyweb/rosetta/locale/uk/LC_MESSAGES/django.po @@ -0,0 +1,162 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Rosetta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-21 12:21+0200\n" +"Last-Translator: Nazar Leush \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: templates/rosetta/languages.html:3 templates/rosetta/pofile.html:13 +msgid "Home" +msgstr "Домівка" + +#: templates/rosetta/languages.html:3 templates/rosetta/languages.html.py:4 +msgid "Language selection" +msgstr "Вибір мови" + +#: templates/rosetta/languages.html:14 +msgid "Application" +msgstr "" + +#: templates/rosetta/languages.html:15 +msgid "Progress" +msgstr "Завершено" + +#: templates/rosetta/languages.html:16 +msgid "Messages" +msgstr "Повідомлень" + +#: templates/rosetta/languages.html:17 +msgid "Translated" +msgstr "Перекладено" + +#: templates/rosetta/languages.html:18 templates/rosetta/pofile.html:48 +msgid "Fuzzy" +msgstr "" + +#: templates/rosetta/languages.html:19 +msgid "Obsolete" +msgstr "Застарілих" + +#: templates/rosetta/languages.html:20 +msgid "File" +msgstr "Файл" + +#: templates/rosetta/languages.html:41 +msgid "Nothing to translate!" +msgstr "" + +#: templates/rosetta/languages.html:42 +msgid "" +"You haven't specified any languages in your settings file, or haven't yet " +"generated a batch of translation catalogs." +msgstr "" + +#: templates/rosetta/languages.html:43 +#, python-format +msgid "" +"Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project." +msgstr "" + +#: templates/rosetta/pofile.html:7 +msgid "Pick another file" +msgstr "Вибрати інший файл" + +#: templates/rosetta/pofile.html:8 +msgid "Download this catalog" +msgstr "Завантажити цей каталог" + +#: templates/rosetta/pofile.html:16 +msgid "Progress: %(percent_translated)s%" +msgstr "Завершено: %(percent_translated)s%" + +#: templates/rosetta/pofile.html:17 +msgid "File is read-only: download the file when done editing!" +msgstr "Файл тільки для читання: завантажте файл після завершення редагування!" + +#: templates/rosetta/pofile.html:19 +msgid "English" +msgstr "Англійська" + +#: templates/rosetta/pofile.html:21 +#, python-format +msgid "Translate into %(rosetta_i18n_lang_name)s" +msgstr "Переклад на %(rosetta_i18n_lang_name)s" + +#: templates/rosetta/pofile.html:24 +msgid "Display:" +msgstr "Відображати:" + +#: templates/rosetta/pofile.html:25 +msgid "Untranslated only" +msgstr "Тільки неперекладені" + +#: templates/rosetta/pofile.html:26 +msgid "Translated only" +msgstr "Тільки перекладені" + +#: templates/rosetta/pofile.html:27 +msgid "Fuzzy only" +msgstr "" + +#: templates/rosetta/pofile.html:28 +msgid "All" +msgstr "" + +#: templates/rosetta/pofile.html:34 +msgid "Search" +msgstr "Пошук" + +#: templates/rosetta/pofile.html:36 +msgid "Go" +msgstr "Вперед" + +#: templates/rosetta/pofile.html:45 +msgid "Original" +msgstr "" + +#: templates/rosetta/pofile.html:49 +msgid "Occurrences(s)" +msgstr "Зустрічається в" + +#: templates/rosetta/pofile.html:73 +msgid "suggest" +msgstr "" + +#: templates/rosetta/pofile.html:84 +#, python-format +msgid "%(more_count)s more" +msgid_plural "%(more_count)s more" +msgstr[0] "" +msgstr[1] "" + +#: templates/rosetta/pofile.html:96 +msgid "Save and translate next block" +msgstr "Записати і перекласти наступний блок" + +#: templates/rosetta/pofile.html:100 +msgid "Skip to page:" +msgstr "Перейти до сторінки:" + +#: templates/rosetta/pofile.html:113 +msgid "Displaying:" +msgstr "Відображення:" + +#: templates/rosetta/pofile.html:115 +#, python-format +msgid "%(hits)s/%(message_number)s message" +msgid_plural "%(hits)s/%(message_number)s messages" +msgstr[0] "%(hits)s/%(message_number)s повідомлення" +msgstr[1] "%(hits)s/%(message_number)s повідомлень" + +#~ msgid "Both" +#~ msgstr "Всі" diff --git a/pyweb/rosetta/models.py b/pyweb/rosetta/models.py new file mode 100644 index 0000000..6f6ad32 --- /dev/null +++ b/pyweb/rosetta/models.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +""" + * Copyright (C) 2010, mbonetti + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. +""" + +from django.db import models +# Create your models here. diff --git a/pyweb/rosetta/polib.py b/pyweb/rosetta/polib.py new file mode 100644 index 0000000..1b32268 --- /dev/null +++ b/pyweb/rosetta/polib.py @@ -0,0 +1,1443 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# License: MIT (see LICENSE file provided) +# vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: + +""" +**polib** allows you to manipulate, create, modify gettext files (pot, po +and mo files). You can load existing files, iterate through it's entries, +add, modify entries, comments or metadata, etc... or create new po files +from scratch. + +**polib** provides a simple and pythonic API, exporting only three +convenience functions (*pofile*, *mofile* and *detect_encoding*), and the +four core classes, *POFile*, *MOFile*, *POEntry* and *MOEntry* for creating +new files/entries. + +**Basic example**: + +>>> import polib +>>> # load an existing po file +>>> po = polib.pofile('tests/test_utf8.po') +>>> for entry in po: +... # do something with entry... +... pass +>>> # add an entry +>>> entry = polib.POEntry(msgid='Welcome', msgstr='Bienvenue') +>>> entry.occurrences = [('welcome.py', '12'), ('anotherfile.py', '34')] +>>> po.append(entry) +>>> # to save our modified po file: +>>> # po.save() +>>> # or you may want to compile the po file +>>> # po.save_as_mofile('tests/test_utf8.mo') + + + * Copyright (C) 2010, David JEAN LOUIS + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + + +""" + +__author__ = 'David JEAN LOUIS ' +__version__ = '0.4.3' +__all__ = ['pofile', 'POFile', 'POEntry', 'mofile', 'MOFile', 'MOEntry', + 'detect_encoding', 'escape', 'unescape'] + +import codecs +import struct +import textwrap +import types + +default_encoding = 'utf-8' + +# function pofile() {{{ + +def pofile(fpath, **kwargs): + """ + Convenience function that parse the po/pot file *fpath* and return + a POFile instance. + + **Keyword arguments**: + - *fpath*: string, full or relative path to the po/pot file to parse + - *wrapwidth*: integer, the wrap width, only useful when -w option was + passed to xgettext (optional, default to 78) + - *autodetect_encoding*: boolean, if set to False the function will + not try to detect the po file encoding (optional, default to True) + - *encoding*: string, an encoding, only relevant if autodetect_encoding + is set to False + + **Example**: + + >>> import polib + >>> po = polib.pofile('tests/test_weird_occurrences.po') + >>> po #doctest: +ELLIPSIS + + >>> import os, tempfile + >>> for fname in ['test_iso-8859-15.po', 'test_utf8.po']: + ... orig_po = polib.pofile('tests/'+fname) + ... tmpf = tempfile.NamedTemporaryFile().name + ... orig_po.save(tmpf) + ... try: + ... new_po = polib.pofile(tmpf) + ... for old, new in zip(orig_po, new_po): + ... if old.msgid != new.msgid: + ... old.msgid + ... new.msgid + ... if old.msgstr != new.msgstr: + ... old.msgid + ... new.msgid + ... finally: + ... os.unlink(tmpf) + >>> po_file = polib.pofile('tests/test_save_as_mofile.po') + >>> tmpf = tempfile.NamedTemporaryFile().name + >>> po_file.save_as_mofile(tmpf) + >>> try: + ... mo_file = polib.mofile(tmpf) + ... for old, new in zip(po_file, mo_file): + ... if po_file._encode(old.msgid) != mo_file._encode(new.msgid): + ... 'OLD: ', po_file._encode(old.msgid) + ... 'NEW: ', mo_file._encode(new.msgid) + ... if po_file._encode(old.msgstr) != mo_file._encode(new.msgstr): + ... 'OLD: ', po_file._encode(old.msgstr) + ... 'NEW: ', mo_file._encode(new.msgstr) + ... print new.msgstr + ... finally: + ... os.unlink(tmpf) + """ + if kwargs.get('autodetect_encoding', True) == True: + enc = detect_encoding(fpath) + else: + enc = kwargs.get('encoding', default_encoding) + parser = _POFileParser(fpath, enc) + instance = parser.parse() + instance.wrapwidth = kwargs.get('wrapwidth', 78) + return instance + +# }}} +# function mofile() {{{ + +def mofile(fpath, **kwargs): + """ + Convenience function that parse the mo file *fpath* and return + a MOFile instance. + + **Keyword arguments**: + - *fpath*: string, full or relative path to the mo file to parse + - *wrapwidth*: integer, the wrap width, only useful when -w option was + passed to xgettext to generate the po file that was used to format + the mo file (optional, default to 78) + - *autodetect_encoding*: boolean, if set to False the function will + not try to detect the po file encoding (optional, default to True) + - *encoding*: string, an encoding, only relevant if autodetect_encoding + is set to False + + **Example**: + + >>> import polib + >>> mo = polib.mofile('tests/test_utf8.mo') + >>> mo #doctest: +ELLIPSIS + + >>> import os, tempfile + >>> for fname in ['test_iso-8859-15.mo', 'test_utf8.mo']: + ... orig_mo = polib.mofile('tests/'+fname) + ... tmpf = tempfile.NamedTemporaryFile().name + ... orig_mo.save(tmpf) + ... try: + ... new_mo = polib.mofile(tmpf) + ... for old, new in zip(orig_mo, new_mo): + ... if old.msgid != new.msgid: + ... old.msgstr + ... new.msgstr + ... finally: + ... os.unlink(tmpf) + """ + if kwargs.get('autodetect_encoding', True) == True: + enc = detect_encoding(fpath, True) + else: + enc = kwargs.get('encoding', default_encoding) + parser = _MOFileParser(fpath, enc) + instance = parser.parse() + instance.wrapwidth = kwargs.get('wrapwidth', 78) + return instance + +# }}} +# function detect_encoding() {{{ + +def detect_encoding(fpath, binary_mode=False): + """ + Try to detect the encoding used by the file *fpath*. The function will + return polib default *encoding* if it's unable to detect it. + + **Keyword argument**: + - *fpath*: string, full or relative path to the mo file to parse. + + **Examples**: + + >>> print(detect_encoding('tests/test_noencoding.po')) + utf-8 + >>> print(detect_encoding('tests/test_utf8.po')) + UTF-8 + >>> print(detect_encoding('tests/test_utf8.mo', True)) + UTF-8 + >>> print(detect_encoding('tests/test_iso-8859-15.po')) + ISO_8859-15 + >>> print(detect_encoding('tests/test_iso-8859-15.mo', True)) + ISO_8859-15 + """ + import re + rx = re.compile(r'"?Content-Type:.+? charset=([\w_\-:\.]+)') + if binary_mode: + mode = 'rb' + else: + mode = 'r' + f = open(fpath, mode) + for l in f.readlines(): + match = rx.search(l) + if match: + f.close() + return match.group(1).strip() + f.close() + return default_encoding + +# }}} +# function escape() {{{ + +def escape(st): + """ + Escape special chars and return the given string *st*. + + **Examples**: + + >>> escape('\\t and \\n and \\r and " and \\\\') + '\\\\t and \\\\n and \\\\r and \\\\" and \\\\\\\\' + """ + st = st.replace('\\', r'\\') + st = st.replace('\t', r'\t') + st = st.replace('\r', r'\r') + st = st.replace('\n', r'\n') + st = st.replace('\"', r'\"') + return st + +# }}} +# function unescape() {{{ + +def unescape(st): + """ + Unescape special chars and return the given string *st*. + + **Examples**: + + >>> unescape('\\\\t and \\\\n and \\\\r and \\\\" and \\\\\\\\') + '\\t and \\n and \\r and " and \\\\' + """ + st = st.replace(r'\"', '"') + st = st.replace(r'\n', '\n') + st = st.replace(r'\r', '\r') + st = st.replace(r'\t', '\t') + st = st.replace(r'\\', '\\') + return st + +# }}} +# class _BaseFile {{{ + +class _BaseFile(list): + """ + Common parent class for POFile and MOFile classes. + This class must **not** be instanciated directly. + """ + + def __init__(self, fpath=None, wrapwidth=78, encoding=default_encoding): + """ + Constructor. + + **Keyword arguments**: + - *fpath*: string, path to po or mo file + - *wrapwidth*: integer, the wrap width, only useful when -w option + was passed to xgettext to generate the po file that was used to + format the mo file, default to 78 (optional). + """ + list.__init__(self) + # the opened file handle + self.fpath = fpath + # the width at which lines should be wrapped + self.wrapwidth = wrapwidth + # the file encoding + self.encoding = encoding + # header + self.header = '' + # both po and mo files have metadata + self.metadata = {} + self.metadata_is_fuzzy = 0 + + def __str__(self): + """String representation of the file.""" + ret = [] + entries = [self.metadata_as_entry()] + \ + [e for e in self if not e.obsolete] + for entry in entries: + ret.append(entry.__str__(self.wrapwidth)) + for entry in self.obsolete_entries(): + ret.append(entry.__str__(self.wrapwidth)) + return '\n'.join(ret) + + def __repr__(self): + """Return the official string representation of the object.""" + return '<%s instance at %x>' % (self.__class__.__name__, id(self)) + + def metadata_as_entry(self): + """Return the metadata as an entry""" + e = POEntry(msgid='') + mdata = self.ordered_metadata() + if mdata: + strs = [] + for name, value in mdata: + # Strip whitespace off each line in a multi-line entry + value = '\n'.join([v.strip() for v in value.split('\n')]) + strs.append('%s: %s' % (name, value)) + e.msgstr = '\n'.join(strs) + '\n' + return e + + def save(self, fpath=None, repr_method='__str__'): + """ + Save the po file to file *fpath* if no file handle exists for + the object. If there's already an open file and no fpath is + provided, then the existing file is rewritten with the modified + data. + + **Keyword arguments**: + - *fpath*: string, full or relative path to the file. + - *repr_method*: string, the method to use for output. + """ + if self.fpath is None and fpath is None: + raise IOError('You must provide a file path to save() method') + contents = getattr(self, repr_method)() + if fpath is None: + fpath = self.fpath + if repr_method == 'to_binary': + fhandle = open(fpath, 'wb') + else: + fhandle = codecs.open(fpath, 'w', self.encoding) + fhandle.write(contents) + fhandle.close() + + def find(self, st, by='msgid'): + """ + Find entry which msgid (or property identified by the *by* + attribute) matches the string *st*. + + **Keyword arguments**: + - *st*: string, the string to search for + - *by*: string, the comparison attribute + + **Examples**: + + >>> po = pofile('tests/test_utf8.po') + >>> entry = po.find('Thursday') + >>> entry.msgstr + u'Jueves' + >>> entry = po.find('Some unexistant msgid') + >>> entry is None + True + >>> entry = po.find('Jueves', 'msgstr') + >>> entry.msgid + u'Thursday' + """ + for e in self: + if getattr(e, by) == st: + return e + return None + + def ordered_metadata(self): + """ + Convenience method that return the metadata ordered. The return + value is list of tuples (metadata name, metadata_value). + """ + # copy the dict first + metadata = self.metadata.copy() + data_order = [ + 'Project-Id-Version', + 'Report-Msgid-Bugs-To', + 'POT-Creation-Date', + 'PO-Revision-Date', + 'Last-Translator', + 'Language-Team', + 'MIME-Version', + 'Content-Type', + 'Content-Transfer-Encoding' + ] + ordered_data = [] + for data in data_order: + try: + value = metadata.pop(data) + ordered_data.append((data, value)) + except KeyError: + pass + # the rest of the metadata won't be ordered there are no specs for this + keys = metadata.keys() + list(keys).sort() + for data in keys: + value = metadata[data] + ordered_data.append((data, value)) + return ordered_data + + def to_binary(self): + """Return the mofile binary representation.""" + import array + import struct + import types + offsets = [] + entries = self.translated_entries() + # the keys are sorted in the .mo file + def cmp(_self, other): + if _self.msgid > other.msgid: + return 1 + elif _self.msgid < other.msgid: + return -1 + else: + return 0 + # add metadata entry + entries.sort(cmp) + mentry = self.metadata_as_entry() + mentry.msgstr = mentry.msgstr.replace('\\n', '').lstrip() + entries = [mentry] + entries + entries_len = len(entries) + ids, strs = '', '' + for e in entries: + # For each string, we need size and file offset. Each string is + # NUL terminated; the NUL does not count into the size. + if e.msgid_plural: + indexes = e.msgstr_plural.keys() + indexes.sort() + msgstr = [] + for index in indexes: + msgstr.append(e.msgstr_plural[index]) + msgid = self._encode(e.msgid + '\0' + e.msgid_plural) + msgstr = self._encode('\0'.join(msgstr)) + else: + msgid = self._encode(e.msgid) + msgstr = self._encode(e.msgstr) + offsets.append((len(ids), len(msgid), len(strs), len(msgstr))) + ids += msgid + '\0' + strs += msgstr + '\0' + # The header is 7 32-bit unsigned integers. + keystart = 7*4+16*entries_len + # and the values start after the keys + valuestart = keystart + len(ids) + koffsets = [] + voffsets = [] + # The string table first has the list of keys, then the list of values. + # Each entry has first the size of the string, then the file offset. + for o1, l1, o2, l2 in offsets: + koffsets += [l1, o1+keystart] + voffsets += [l2, o2+valuestart] + offsets = koffsets + voffsets + output = struct.pack("IIIIIII", + 0x950412de, # Magic number + 0, # Version + entries_len, # # of entries + 7*4, # start of key index + 7*4+entries_len*8, # start of value index + 0, 0) # size and offset of hash table + output += array.array("I", offsets).tostring() + output += ids + output += strs + return output + + def _encode(self, mixed): + """ + Encode the given argument with the file encoding if the type is unicode + and return the encoded string. + """ + if type(mixed) == types.UnicodeType: + return mixed.encode(self.encoding) + return mixed + +# }}} +# class POFile {{{ + +class POFile(_BaseFile): + ''' + Po (or Pot) file reader/writer. + POFile objects inherit the list objects methods. + + **Example**: + + >>> po = POFile() + >>> entry1 = POEntry( + ... msgid="Some english text", + ... msgstr="Un texte en anglais" + ... ) + >>> entry1.occurrences = [('testfile', 12),('another_file', 1)] + >>> entry1.comment = "Some useful comment" + >>> entry2 = POEntry( + ... msgid="Peace in some languages", + ... msgstr="Pace سلام שלום Hasîtî 和平" + ... ) + >>> entry2.occurrences = [('testfile', 15),('another_file', 5)] + >>> entry2.comment = "Another useful comment" + >>> entry3 = POEntry( + ... msgid='Some entry with quotes " \\"', + ... msgstr='Un message unicode avec des quotes " \\"' + ... ) + >>> entry3.comment = "Test string quoting" + >>> po.append(entry1) + >>> po.append(entry2) + >>> po.append(entry3) + >>> po.header = "Some Header" + >>> print(po) + # Some Header + msgid "" + msgstr "" + + #. Some useful comment + #: testfile:12 another_file:1 + msgid "Some english text" + msgstr "Un texte en anglais" + + #. Another useful comment + #: testfile:15 another_file:5 + msgid "Peace in some languages" + msgstr "Pace سلام שלום Hasîtî 和平" + + #. Test string quoting + msgid "Some entry with quotes \\" \\"" + msgstr "Un message unicode avec des quotes \\" \\"" + + ''' + + def __str__(self): + """Return the string representation of the po file""" + ret, headers = '', self.header.split('\n') + for header in headers: + if header[:1] in [',', ':']: + ret += '#%s\n' % header + else: + ret += '# %s\n' % header + return ret + _BaseFile.__str__(self) + + def save_as_mofile(self, fpath): + """ + Save the binary representation of the file to *fpath*. + + **Keyword arguments**: + - *fpath*: string, full or relative path to the file. + """ + _BaseFile.save(self, fpath, 'to_binary') + + def percent_translated(self): + """ + Convenience method that return the percentage of translated + messages. + + **Example**: + + >>> import polib + >>> po = polib.pofile('tests/test_pofile_helpers.po') + >>> po.percent_translated() + 50 + >>> po = POFile() + >>> po.percent_translated() + 100 + """ + total = len([e for e in self if not e.obsolete]) + if total == 0: + return 100 + translated = len(self.translated_entries()) + return int((100.00 / float(total)) * translated) + + def translated_entries(self): + """ + Convenience method that return a list of translated entries. + + **Example**: + + >>> import polib + >>> po = polib.pofile('tests/test_pofile_helpers.po') + >>> len(po.translated_entries()) + 6 + """ + return [e for e in self if e.translated() and not e.obsolete] + + def untranslated_entries(self): + """ + Convenience method that return a list of untranslated entries. + + **Example**: + + >>> import polib + >>> po = polib.pofile('tests/test_pofile_helpers.po') + >>> len(po.untranslated_entries()) + 6 + """ + return [e for e in self if not e.translated() and not e.obsolete] + + def fuzzy_entries(self): + """ + Convenience method that return the list of 'fuzzy' entries. + + **Example**: + + >>> import polib + >>> po = polib.pofile('tests/test_pofile_helpers.po') + >>> len(po.fuzzy_entries()) + 2 + """ + return [e for e in self if 'fuzzy' in e.flags] + + def obsolete_entries(self): + """ + Convenience method that return the list of obsolete entries. + + **Example**: + + >>> import polib + >>> po = polib.pofile('tests/test_pofile_helpers.po') + >>> len(po.obsolete_entries()) + 4 + """ + return [e for e in self if e.obsolete] + + def merge(self, refpot): + """ + XXX this could not work if encodings are different, needs thinking + and general refactoring of how polib handles encoding... + + Convenience method that merge the current pofile with the pot file + provided. It behaves exactly as the gettext msgmerge utility: + + - comments of this file will be preserved, but extracted comments + and occurrences will be discarded + - any translations or comments in the file will be discarded, + however dot comments and file positions will be preserved + + **Keyword argument**: + - *refpot*: object POFile, the reference catalog. + + **Example**: + + >>> import polib + >>> refpot = polib.pofile('tests/test_merge.pot') + >>> po = polib.pofile('tests/test_merge_before.po') + >>> po.merge(refpot) + >>> expected_po = polib.pofile('tests/test_merge_after.po') + >>> unicode(po) == unicode(expected_po) + True + """ + for entry in refpot: + e = self.find(entry.msgid) + if e is None: + e = POEntry() + self.append(e) + e.merge(entry) + # ok, now we must "obsolete" entries that are not in the refpot + # anymore + for entry in self: + if refpot.find(entry.msgid) is None: + entry.obsolete = True + +# }}} +# class MOFile {{{ + +class MOFile(_BaseFile): + ''' + Mo file reader/writer. + MOFile objects inherit the list objects methods. + + **Example**: + + >>> mo = MOFile() + >>> entry1 = POEntry( + ... msgid="Some english text", + ... msgstr="Un texte en anglais" + ... ) + >>> entry2 = POEntry( + ... msgid="I need my dirty cheese", + ... msgstr="Je veux mon sale fromage" + ... ) + >>> entry3 = MOEntry( + ... msgid='Some entry with quotes " \\"', + ... msgstr='Un message unicode avec des quotes " \\"' + ... ) + >>> mo.append(entry1) + >>> mo.append(entry2) + >>> mo.append(entry3) + >>> print(mo) + msgid "" + msgstr "" + + msgid "Some english text" + msgstr "Un texte en anglais" + + msgid "I need my dirty cheese" + msgstr "Je veux mon sale fromage" + + msgid "Some entry with quotes \\" \\"" + msgstr "Un message unicode avec des quotes \\" \\"" + + ''' + + def __init__(self, *args, **kwargs): + """ + MOFile constructor. Mo files have two other properties: + - magic_number: the magic_number of the binary file, + - version: the version of the mo spec. + """ + _BaseFile.__init__(self, *args, **kwargs) + self.magic_number = None + self.version = 0 + + def save_as_pofile(self, fpath): + """ + Save the string representation of the file to *fpath*. + + **Keyword argument**: + - *fpath*: string, full or relative path to the file. + """ + _BaseFile.save(self, fpath) + + def save(self, fpath): + """ + Save the binary representation of the file to *fpath*. + + **Keyword argument**: + - *fpath*: string, full or relative path to the file. + """ + _BaseFile.save(self, fpath, 'to_binary') + + def percent_translated(self): + """ + Convenience method to keep the same interface with POFile instances. + """ + return 100 + + def translated_entries(self): + """ + Convenience method to keep the same interface with POFile instances. + """ + return self + + def untranslated_entries(self): + """ + Convenience method to keep the same interface with POFile instances. + """ + return [] + + def fuzzy_entries(self): + """ + Convenience method to keep the same interface with POFile instances. + """ + return [] + + def obsolete_entries(self): + """ + Convenience method to keep the same interface with POFile instances. + """ + return [] + +# }}} +# class _BaseEntry {{{ + +class _BaseEntry(object): + """ + Base class for POEntry or MOEntry objects. + This class must *not* be instanciated directly. + """ + + def __init__(self, *args, **kwargs): + """Base Entry constructor.""" + self.msgid = kwargs.get('msgid', '') + self.msgstr = kwargs.get('msgstr', '') + self.msgid_plural = kwargs.get('msgid_plural', '') + self.msgstr_plural = kwargs.get('msgstr_plural', {}) + self.obsolete = kwargs.get('obsolete', False) + self.encoding = kwargs.get('encoding', default_encoding) + self.msgctxt = kwargs.get('msgctxt', None) + + def __repr__(self): + """Return the official string representation of the object.""" + return '<%s instance at %x>' % (self.__class__.__name__, id(self)) + + def __str__(self, wrapwidth=78): + """ + Common string representation of the POEntry and MOEntry + objects. + """ + if self.obsolete: + delflag = '#~ ' + else: + delflag = '' + ret = [] + # write the msgctxt if any + if self.msgctxt is not None: + ret += self._str_field("msgctxt", delflag, "", self.msgctxt) + # write the msgid + ret += self._str_field("msgid", delflag, "", self.msgid) + # write the msgid_plural if any + if self.msgid_plural: + ret += self._str_field("msgid_plural", delflag, "", self.msgid_plural) + if self.msgstr_plural: + # write the msgstr_plural if any + msgstrs = self.msgstr_plural + keys = list(msgstrs) + keys.sort() + for index in keys: + msgstr = msgstrs[index] + plural_index = '[%s]' % index + ret += self._str_field("msgstr", delflag, plural_index, msgstr) + else: + # otherwise write the msgstr + ret += self._str_field("msgstr", delflag, "", self.msgstr) + ret.append('') + return '\n'.join(ret) + + def _str_field(self, fieldname, delflag, plural_index, field): + lines = field.splitlines(True) # keep line breaks in strings + # potentially, we could do line-wrapping here, but textwrap.wrap + # treats whitespace too carelessly for us to use it. + if len(lines) > 1: + lines = ['']+lines # start with initial empty line + else: + lines = [field] # needed for the empty string case + ret = ['%s%s%s "%s"' % (delflag, fieldname, plural_index, + escape(lines.pop(0)))] + for mstr in lines: + ret.append('%s"%s"' % (delflag, escape(mstr))) + return ret + +# }}} +# class POEntry {{{ + +class POEntry(_BaseEntry): + """ + Represents a po file entry. + + **Examples**: + + >>> entry = POEntry(msgid='Welcome', msgstr='Bienvenue') + >>> entry.occurrences = [('welcome.py', 12), ('anotherfile.py', 34)] + >>> print(entry) + #: welcome.py:12 anotherfile.py:34 + msgid "Welcome" + msgstr "Bienvenue" + + >>> entry = POEntry() + >>> entry.occurrences = [('src/some-very-long-filename-that-should-not-be-wrapped-even-if-it-is-larger-than-the-wrap-limit.c', 32), ('src/eggs.c', 45)] + >>> entry.comment = 'A plural translation. This is a very very very long line please do not wrap, this is just for testing comment wrapping...' + >>> entry.tcomment = 'A plural translation. This is a very very very long line please do not wrap, this is just for testing comment wrapping...' + >>> entry.flags.append('c-format') + >>> entry.msgid = 'I have spam but no egg !' + >>> entry.msgid_plural = 'I have spam and %d eggs !' + >>> entry.msgstr_plural[0] = "J'ai du jambon mais aucun oeuf !" + >>> entry.msgstr_plural[1] = "J'ai du jambon et %d oeufs !" + >>> print(entry) + #. A plural translation. This is a very very very long line please do not + #. wrap, this is just for testing comment wrapping... + # A plural translation. This is a very very very long line please do not wrap, + # this is just for testing comment wrapping... + #: src/some-very-long-filename-that-should-not-be-wrapped-even-if-it-is-larger-than-the-wrap-limit.c:32 + #: src/eggs.c:45 + #, c-format + msgid "I have spam but no egg !" + msgid_plural "I have spam and %d eggs !" + msgstr[0] "J'ai du jambon mais aucun oeuf !" + msgstr[1] "J'ai du jambon et %d oeufs !" + + """ + + def __init__(self, *args, **kwargs): + """POEntry constructor.""" + _BaseEntry.__init__(self, *args, **kwargs) + self.comment = kwargs.get('comment', '') + self.tcomment = kwargs.get('tcomment', '') + self.occurrences = kwargs.get('occurrences', []) + self.flags = kwargs.get('flags', []) + + def __str__(self, wrapwidth=78): + """ + Return the string representation of the entry. + """ + if self.obsolete: + return _BaseEntry.__str__(self) + ret = [] + # comment first, if any (with text wrapping as xgettext does) + if self.comment != '': + for comment in self.comment.split('\n'): + if wrapwidth > 0 and len(comment) > wrapwidth-3: + ret += textwrap.wrap(comment, wrapwidth, + initial_indent='#. ', + subsequent_indent='#. ', + break_long_words=False) + else: + ret.append('#. %s' % comment) + # translator comment, if any (with text wrapping as xgettext does) + if self.tcomment != '': + for tcomment in self.tcomment.split('\n'): + if wrapwidth > 0 and len(tcomment) > wrapwidth-2: + ret += textwrap.wrap(tcomment, wrapwidth, + initial_indent='# ', + subsequent_indent='# ', + break_long_words=False) + else: + ret.append('# %s' % tcomment) + # occurrences (with text wrapping as xgettext does) + if self.occurrences: + filelist = [] + for fpath, lineno in self.occurrences: + if lineno: + filelist.append('%s:%s' % (fpath, lineno)) + else: + filelist.append(fpath) + filestr = ' '.join(filelist) + if wrapwidth > 0 and len(filestr)+3 > wrapwidth: + # XXX textwrap split words that contain hyphen, this is not + # what we want for filenames, so the dirty hack is to + # temporally replace hyphens with a char that a file cannot + # contain, like "*" + lines = textwrap.wrap(filestr.replace('-', '*'), + wrapwidth, + initial_indent='#: ', + subsequent_indent='#: ', + break_long_words=False) + # end of the replace hack + for line in lines: + ret.append(line.replace('*', '-')) + else: + ret.append('#: '+filestr) + # flags + if self.flags: + flags = [] + for flag in self.flags: + flags.append(flag) + ret.append('#, %s' % ', '.join(flags)) + ret.append(_BaseEntry.__str__(self)) + + return '\n'.join(ret) + + def __cmp__(self, other): + ''' + Called by comparison operations if rich comparison is not defined. + + **Tests**: + >>> a = POEntry(msgid='a', occurrences=[('b.py', 1), ('b.py', 3)]) + >>> b = POEntry(msgid='b', occurrences=[('b.py', 1), ('b.py', 3)]) + >>> c1 = POEntry(msgid='c1', occurrences=[('a.py', 1), ('b.py', 1)]) + >>> c2 = POEntry(msgid='c2', occurrences=[('a.py', 1), ('a.py', 3)]) + >>> po = POFile() + >>> po.append(a) + >>> po.append(b) + >>> po.append(c1) + >>> po.append(c2) + >>> po.sort() + >>> print(po) + # + msgid "" + msgstr "" + + #: a.py:1 a.py:3 + msgid "c2" + msgstr "" + + #: a.py:1 b.py:1 + msgid "c1" + msgstr "" + + #: b.py:1 b.py:3 + msgid "a" + msgstr "" + + #: b.py:1 b.py:3 + msgid "b" + msgstr "" + + ''' + def compare_occurrences(a, b): + """ + Compare an entry occurrence with another one. + """ + if a[0] != b[0]: + return a[0] < b[0] + if a[1] != b[1]: + return a[1] < b[1] + return 0 + + # First: Obsolete test + if self.obsolete != other.obsolete: + if self.obsolete: + return -1 + else: + return 1 + # Work on a copy to protect original + occ1 = self.occurrences[:] + occ2 = other.occurrences[:] + # Sorting using compare method + occ1.sort(compare_occurrences) + occ2.sort(compare_occurrences) + # Comparing sorted occurrences + pos = 0 + for entry1 in occ1: + try: + entry2 = occ2[pos] + except IndexError: + return 1 + pos = pos + 1 + if entry1[0] != entry2[0]: + if entry1[0] > entry2[0]: + return 1 + else: + return -1 + if entry1[1] != entry2[1]: + if entry1[1] > entry2[1]: + return 1 + else: + return -1 + # Finally: Compare message ID + if self.msgid > other.msgid: return 1 + else: return -1 + + def translated(self): + """ + Return True if the entry has been translated or False. + """ + if self.obsolete or 'fuzzy' in self.flags: + return False + if self.msgstr != '': + return True + if self.msgstr_plural: + for pos in self.msgstr_plural: + if self.msgstr_plural[pos] == '': + return False + return True + return False + + def merge(self, other): + """ + Merge the current entry with the given pot entry. + """ + self.msgid = other.msgid + self.occurrences = other.occurrences + self.comment = other.comment + self.flags = other.flags + self.msgid_plural = other.msgid_plural + if other.msgstr_plural: + for pos in other.msgstr_plural: + try: + # keep existing translation at pos if any + self.msgstr_plural[pos] + except KeyError: + self.msgstr_plural[pos] = '' + +# }}} +# class MOEntry {{{ + +class MOEntry(_BaseEntry): + """ + Represents a mo file entry. + + **Examples**: + + >>> entry = MOEntry() + >>> entry.msgid = 'translate me !' + >>> entry.msgstr = 'traduisez moi !' + >>> print(entry) + msgid "translate me !" + msgstr "traduisez moi !" + + """ + + def __str__(self, wrapwidth=78): + """ + Return the string representation of the entry. + """ + return _BaseEntry.__str__(self, wrapwidth) + +# }}} +# class _POFileParser {{{ + +class _POFileParser(object): + """ + A finite state machine to parse efficiently and correctly po + file format. + """ + + def __init__(self, fpath, enc=default_encoding): + """ + Constructor. + + **Keyword argument**: + - *fpath*: string, path to the po file + """ + try: + self.fhandle = codecs.open(fpath, 'rU', enc) + except LookupError: + enc = default_encoding + self.fhandle = codecs.open(fpath, 'rU', enc) + self.instance = POFile(fpath=fpath, encoding=enc) + self.transitions = {} + self.current_entry = POEntry() + self.current_state = 'ST' + self.current_token = None + # two memo flags used in handlers + self.msgstr_index = 0 + self.entry_obsolete = 0 + # Configure the state machine, by adding transitions. + # Signification of symbols: + # * ST: Beginning of the file (start) + # * HE: Header + # * TC: a translation comment + # * GC: a generated comment + # * OC: a file/line occurence + # * FL: a flags line + # * CT: a message context + # * MI: a msgid + # * MP: a msgid plural + # * MS: a msgstr + # * MX: a msgstr plural + # * MC: a msgid or msgstr continuation line + all = ['ST', 'HE', 'GC', 'OC', 'FL', 'CT', 'TC', 'MS', 'MP', 'MX', 'MI'] + + self.add('TC', ['ST', 'HE'], 'HE') + self.add('TC', ['GC', 'OC', 'FL', 'TC', 'MS', 'MP', 'MX', 'MI'], 'TC') + self.add('GC', all, 'GC') + self.add('OC', all, 'OC') + self.add('FL', all, 'FL') + self.add('CT', ['ST', 'HE', 'GC', 'OC', 'FL', 'TC', 'MS', 'MX'], 'CT') + self.add('MI', ['ST', 'HE', 'GC', 'OC', 'FL', 'CT', 'TC', 'MS', 'MX'], + 'MI') + self.add('MP', ['TC', 'GC', 'MI'], 'MP') + self.add('MS', ['MI', 'MP', 'TC'], 'MS') + self.add('MX', ['MI', 'MX', 'MP', 'TC'], 'MX') + self.add('MC', ['CT', 'MI', 'MP', 'MS', 'MX'], 'MC') + + def parse(self): + """ + Run the state machine, parse the file line by line and call process() + with the current matched symbol. + """ + i, lastlen = 1, 0 + for line in self.fhandle: + line = line.strip() + if line == '': + i = i+1 + continue + if line[:3] == '#~ ': + line = line[3:] + self.entry_obsolete = 1 + else: + self.entry_obsolete = 0 + self.current_token = line + if line[:2] == '#:': + # we are on a occurrences line + self.process('OC', i) + elif line[:9] == 'msgctxt "': + # we are on a msgctxt + self.process('CT', i) + elif line[:7] == 'msgid "': + # we are on a msgid + self.process('MI', i) + elif line[:8] == 'msgstr "': + # we are on a msgstr + self.process('MS', i) + elif line[:1] == '"': + # we are on a continuation line or some metadata + self.process('MC', i) + elif line[:14] == 'msgid_plural "': + # we are on a msgid plural + self.process('MP', i) + elif line[:7] == 'msgstr[': + # we are on a msgstr plural + self.process('MX', i) + elif line[:3] == '#, ': + # we are on a flags line + self.process('FL', i) + elif line[:2] == '# ' or line == '#': + if line == '#': line = line + ' ' + # we are on a translator comment line + self.process('TC', i) + elif line[:2] == '#.': + # we are on a generated comment line + self.process('GC', i) + i = i+1 + + if self.current_entry: + # since entries are added when another entry is found, we must add + # the last entry here (only if there are lines) + self.instance.append(self.current_entry) + # before returning the instance, check if there's metadata and if + # so extract it in a dict + firstentry = self.instance[0] + if firstentry.msgid == '': # metadata found + # remove the entry + firstentry = self.instance.pop(0) + self.instance.metadata_is_fuzzy = firstentry.flags + key = None + for msg in firstentry.msgstr.splitlines(): + try: + key, val = msg.split(':', 1) + self.instance.metadata[key] = val.strip() + except: + if key is not None: + self.instance.metadata[key] += '\n'+ msg.strip() + # close opened file + self.fhandle.close() + return self.instance + + def add(self, symbol, states, next_state): + """ + Add a transition to the state machine. + Keywords arguments: + + symbol -- string, the matched token (two chars symbol) + states -- list, a list of states (two chars symbols) + next_state -- the next state the fsm will have after the action + """ + for state in states: + action = getattr(self, 'handle_%s' % next_state.lower()) + self.transitions[(symbol, state)] = (action, next_state) + + def process(self, symbol, linenum): + """ + Process the transition corresponding to the current state and the + symbol provided. + + Keywords arguments: + symbol -- string, the matched token (two chars symbol) + linenum -- integer, the current line number of the parsed file + """ + try: + (action, state) = self.transitions[(symbol, self.current_state)] + if action(): + self.current_state = state + except Exception, exc: + raise + raise IOError('Syntax error in po file (line %s)' % linenum) + + # state handlers + + def handle_he(self): + """Handle a header comment.""" + if self.instance.header != '': + self.instance.header += '\n' + self.instance.header += self.current_token[2:] + return 1 + + def handle_tc(self): + """Handle a translator comment.""" + if self.current_state in ['MC', 'MS', 'MX']: + self.instance.append(self.current_entry) + self.current_entry = POEntry() + if self.current_entry.tcomment != '': + self.current_entry.tcomment += '\n' + self.current_entry.tcomment += self.current_token[2:] + return True + + def handle_gc(self): + """Handle a generated comment.""" + if self.current_state in ['MC', 'MS', 'MX']: + self.instance.append(self.current_entry) + self.current_entry = POEntry() + if self.current_entry.comment != '': + self.current_entry.comment += '\n' + self.current_entry.comment += self.current_token[3:] + return True + + def handle_oc(self): + """Handle a file:num occurence.""" + if self.current_state in ['MC', 'MS', 'MX']: + self.instance.append(self.current_entry) + self.current_entry = POEntry() + occurrences = self.current_token[3:].split() + for occurrence in occurrences: + if occurrence != '': + try: + fil, line = occurrence.split(':') + if not line.isdigit(): + fil = fil + line + line = '' + self.current_entry.occurrences.append((fil, line)) + except: + self.current_entry.occurrences.append((occurrence, '')) + return True + + def handle_fl(self): + """Handle a flags line.""" + if self.current_state in ['MC', 'MS', 'MX']: + self.instance.append(self.current_entry) + self.current_entry = POEntry() + self.current_entry.flags += self.current_token[3:].split(', ') + return True + + def handle_ct(self): + """Handle a msgctxt.""" + if self.current_state in ['MC', 'MS', 'MX']: + self.instance.append(self.current_entry) + self.current_entry = POEntry() + self.current_entry.msgctxt = unescape(self.current_token[9:-1]) + return True + + def handle_mi(self): + """Handle a msgid.""" + if self.current_state in ['MC', 'MS', 'MX']: + self.instance.append(self.current_entry) + self.current_entry = POEntry() + self.current_entry.obsolete = self.entry_obsolete + self.current_entry.msgid = unescape(self.current_token[7:-1]) + return True + + def handle_mp(self): + """Handle a msgid plural.""" + self.current_entry.msgid_plural = unescape(self.current_token[14:-1]) + return True + + def handle_ms(self): + """Handle a msgstr.""" + self.current_entry.msgstr = unescape(self.current_token[8:-1]) + return True + + def handle_mx(self): + """Handle a msgstr plural.""" + index, value = self.current_token[7], self.current_token[11:-1] + self.current_entry.msgstr_plural[index] = unescape(value) + self.msgstr_index = index + return True + + def handle_mc(self): + """Handle a msgid or msgstr continuation line.""" + if self.current_state == 'CT': + self.current_entry.msgctxt += unescape(self.current_token[1:-1]) + elif self.current_state == 'MI': + self.current_entry.msgid += unescape(self.current_token[1:-1]) + elif self.current_state == 'MP': + self.current_entry.msgid_plural += \ + unescape(self.current_token[1:-1]) + elif self.current_state == 'MS': + self.current_entry.msgstr += unescape(self.current_token[1:-1]) + elif self.current_state == 'MX': + msgstr = self.current_entry.msgstr_plural[self.msgstr_index] +\ + unescape(self.current_token[1:-1]) + self.current_entry.msgstr_plural[self.msgstr_index] = msgstr + # don't change the current state + return False + +# }}} +# class _MOFileParser {{{ + +class _MOFileParser(object): + """ + A class to parse binary mo files. + """ + BIG_ENDIAN = 0xde120495 + LITTLE_ENDIAN = 0x950412de + + def __init__(self, fpath, enc=default_encoding): + """_MOFileParser constructor.""" + self.fhandle = open(fpath, 'rb') + self.instance = MOFile(fpath=fpath, encoding=enc) + + def parse_magicnumber(self): + """ + Parse the magic number and raise an exception if not valid. + """ + + def parse(self): + """ + Build the instance with the file handle provided in the + constructor. + """ + magic_number = self._readbinary('. + It returns a tuple or a mixed value if the tuple length is 1. + """ + bytes = self.fhandle.read(numbytes) + tup = struct.unpack(fmt, bytes) + if len(tup) == 1: + return tup[0] + return tup + +# }}} +# __main__ {{{ + +if __name__ == '__main__': + """ + **Main function**:: + - to **test** the module just run: *python polib.py [-v]* + - to **profile** the module: *python polib.py -p * + """ + import sys + if len(sys.argv) > 2 and sys.argv[1] == '-p': + def test(f): + if f.endswith('po'): + p = pofile(f) + else: + p = mofile(f) + s = str(p) + import profile + profile.run('test("'+sys.argv[2]+'")') + else: + import doctest + doctest.testmod() + +# }}} diff --git a/pyweb/rosetta/poutil.py b/pyweb/rosetta/poutil.py new file mode 100644 index 0000000..6a070fa --- /dev/null +++ b/pyweb/rosetta/poutil.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- + +""" + * Copyright (C) 2010, mbonetti + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. +""" + +import re, string, sys, os +from django.conf import settings +try: + set +except NameError: + from sets import Set as set # Python 2.3 fallback + +def find_pos(lang, include_djangos = False, include_rosetta = False): + """ + scans a couple possible repositories of gettext catalogs for the given + language code + + """ + + paths = [] + + # project/locale + parts = settings.SETTINGS_MODULE.split('.') + project = __import__(parts[0], {}, {}, []) + paths.append(os.path.join(os.path.dirname(project.__file__), 'locale')) + + # django/locale + if include_djangos: + paths.append(os.path.join(os.path.dirname(sys.modules[settings.__module__].__file__), 'locale')) + + # settings + for localepath in settings.LOCALE_PATHS: + if os.path.isdir(localepath): + paths.append(localepath) + + # project/app/locale + for appname in settings.INSTALLED_APPS: + if 'rosetta' == appname and include_rosetta == False: + continue + + p = appname.rfind('.') + if p >= 0: + app = getattr(__import__(appname[:p], {}, {}, [appname[p+1:]]), appname[p+1:]) + else: + app = __import__(appname, {}, {}, []) + + apppath = os.path.join(os.path.dirname(app.__file__), 'locale') + + if os.path.isdir(apppath): + paths.append(apppath) + + ret = set() + rx=re.compile(r'(\w+)/../\1') + langs = (lang,) + if u'-' in lang: + _l,_c = map(lambda x:x.lower(),lang.split(u'-')) + langs += (u'%s_%s' %(_l, _c), u'%s_%s' %(_l, _c.upper()), ) + elif u'_' in lang: + _l,_c = map(lambda x:x.lower(),lang.split(u'_')) + langs += (u'%s-%s' %(_l, _c), u'%s-%s' %(_l, _c.upper()), ) + + for path in paths: + for lang_ in langs: + dirname = rx.sub(r'\1', '%s/%s/LC_MESSAGES/' %(path,lang_)) + for fn in ('django.po','djangojs.po',): + if os.path.isfile(dirname+fn): + ret.add(os.path.abspath(dirname+fn)) + return list(ret) + +def pagination_range(first,last,current): + r = [] + + r.append(first) + if first + 1 < last: r.append(first+1) + + if current -2 > first and current -2 < last: r.append(current-2) + if current -1 > first and current -1 < last: r.append(current-1) + if current > first and current < last: r.append(current) + if current + 1 < last and current+1 > first: r.append(current+1) + if current + 2 < last and current+2 > first: r.append(current+2) + + if last-1 > first: r.append(last-1) + r.append(last) + + r = list(set(r)) + r.sort() + prev = 10000 + for e in r[:]: + if prev + 1 < e: + try: + r.insert(r.index(e), '...') + except ValueError: + pass + prev = e + return r diff --git a/pyweb/rosetta/templates/rosetta/base.html b/pyweb/rosetta/templates/rosetta/base.html new file mode 100644 index 0000000..292ceb8 --- /dev/null +++ b/pyweb/rosetta/templates/rosetta/base.html @@ -0,0 +1,41 @@ + + + + + + + + + + + + Rosetta - {% block pagetitle %}{% endblock %} + + +
+ + +
+ {% block main %}{% endblock %} +
+ +
+ + diff --git a/pyweb/rosetta/templates/rosetta/css/rosetta.css b/pyweb/rosetta/templates/rosetta/css/rosetta.css new file mode 100644 index 0000000..11d6f91 --- /dev/null +++ b/pyweb/rosetta/templates/rosetta/css/rosetta.css @@ -0,0 +1,28 @@ +#user-tools p span { margin-left:2em; } +table{width:100%;} +td.translation label {font-size: 95%;} +td.translation textarea, td.original { font-size:110%;} +td.translation,td.original {width:30%;} +td.original .plural-container { position:relative} +td.translation textarea{ width:98.5%; min-height:25px; margin:2px 0; } +.rtl td.translation textarea { direction: rtl;} +.plural span {display:block; margin:2px 0; position:absolute} +td.location code,td.location a { font-size:95%; display:block;} +td.location code.hide { display:none;} +.submit-row {margin-bottom:0;} +li.nobubble,li.nobubble:hover { background-image:none;} +.object-tools li.active, .object-tools li.active a { color:yellow;} +p.paginator input { float:right;} +p.paginator span.space { margin: 0 0.5em;} +.paginator {text-align:left; border:none; background:transparent; } +.paginator strong { margin-left:1em;} +th.r,td.r {text-align:right;} +th.c,td.c {text-align: center;} +td.original code {font-size:90%; padding: 0 1px; } +tr.row2 td.original code {background-color:#FFB2A5; padding: 0 0.3em;} +tr.row1 td.original code {background-color:#FFB2A5;} +.alert { font-weight:bold;padding:4px 5px 4px 25px; margin-left:1em; color: red; background:transparent url({{ADMIN_MEDIA_PREFIX}}img/admin/icon_alert.gif) 5px .3em no-repeat; } +#footer { clear:both; color:#999; font-size:9px; margin:0 6px; text-align:left;} +#changelist table tbody td:first-child, #changelist table thead th:first-child {text-align: left;} +td.hint {color: #777;} +div.module {margin-bottom: 20px;} diff --git a/pyweb/rosetta/templates/rosetta/js/rosetta.js b/pyweb/rosetta/templates/rosetta/js/rosetta.js new file mode 100644 index 0000000..ba6bcd4 --- /dev/null +++ b/pyweb/rosetta/templates/rosetta/js/rosetta.js @@ -0,0 +1,57 @@ +google.setOnLoadCallback(function() { + $('.location a').show().toggle(function() { + $('.hide', $(this).parent()).show(); + }, function() { + $('.hide', $(this).parent()).hide(); + }); +{% if ENABLE_TRANSLATION_SUGGESTIONS %} + $('a.suggest').click(function() { + var a=$(this), str=a.html(); orig=$('.original', a.parents('tr')).html(),trans=$('textarea',a.parent()); + orig = unescape(orig).replace(//g,'\n').replace(//g,'').replace(/<\/code>/g,'').replace(/>/g,'>').replace(/</g,'<'); + a.attr('class','suggesting').html('...'); + google.language.translate(orig, "en", '{{rosetta_i18n_lang_code}}', function(result) { + if (!result.error) { + trans.val(unescape(result.translation).replace(/'/g,'\'').replace(/"/g,'"').replace(/%\s+(\([^\)]+\))\s*s/g,' %$1s ')); + a.hide(); + } else { + a.hide().before($(''+result.error.message+'')); + } + }); + return false; + }); +{% endif %} + $('td.plural').each(function(i) { + var td = $(this), trY = parseInt(td.closest('tr').offset().top); + $('textarea', $(this).closest('tr')).each(function(j) { + var textareaY= parseInt($(this).offset().top) - trY; + $($('.part',td).get(j)).css('top',textareaY + 'px'); + }); + }); + + $('.translation textarea').blur(function() { + if($(this).val()) { + $('.alert', $(this).parents('tr')).remove(); + var RX = /%(?:\([^\s\)]*\))?[sdf]/g, + origs=$('.original', $(this).parents('tr')).html().match(RX), + trads=$(this).val().match(RX), + error = $('Unmatched variables'); + if (origs && trads) { + for (var i = trads.length; i--;){ + var key = trads[i]; + if (-1 == $.inArray(key, origs)) { + $(this).before(error) + return false; + } + } + return true; + } else { + if (!(origs === null && trads === null)) { + $(this).before(error); + return false; + } + } + return true; + } + }); + +}); diff --git a/pyweb/rosetta/templates/rosetta/languages.html b/pyweb/rosetta/templates/rosetta/languages.html new file mode 100644 index 0000000..257f8b3 --- /dev/null +++ b/pyweb/rosetta/templates/rosetta/languages.html @@ -0,0 +1,45 @@ +{% extends "rosetta/base.html" %} +{% load i18n %} +{% block breadcumbs %}{% trans "Home" %} › {% trans "Language selection" %}{% endblock %} +{% block pagetitle %}{% trans "Language selection" %}{% endblock %} +{% block main %} + {% if has_pos %} + {% for lid,language,pos in languages %} + {% if pos %} +
+

{{language}}

+ + + + + + + + + + + + + + {% for app,path,po in pos %} + + + + + + + + + + {% endfor %} + +
{% trans "Application" %}{% trans "Progress"%}{% trans "Messages" %}{% trans "Translated" %}{% trans "Fuzzy"%}{% trans "Obsolete"%}{% trans "File" %}
{{ app|title }}{{po.percent_translated|floatformat:2}}%{{po|length}}{{po.translated_entries|length}}{{po.fuzzy_entries|length}}{{po.obsolete_entries|length}}{{ path }}
+
+ {% endif %} + {% endfor %} + {% else %} +

{% trans "Nothing to translate!" %}

+

{% trans "You haven't specified any languages in your settings file, or haven't yet generated a batch of translation catalogs." %}

+

{% blocktrans with "http://docs.djangoproject.com/en/dev/topics/i18n/#topics-i18n" as i18n_doc_link %}Please refer to Django's I18N documentation for a guide on how to set up internationalization for your project.{% endblocktrans %}

+ {% endif %} +{% endblock %} diff --git a/pyweb/rosetta/templates/rosetta/pofile.html b/pyweb/rosetta/templates/rosetta/pofile.html new file mode 100644 index 0000000..8433d62 --- /dev/null +++ b/pyweb/rosetta/templates/rosetta/pofile.html @@ -0,0 +1,125 @@ +{% extends "rosetta/base.html" %} +{% load rosetta i18n %} + +{% block header %} + {{block.super}} + +{% endblock %} +{% block breadcumbs %} + {% trans "Home" %} › + {{ rosetta_i18n_lang_name }} › + {{ rosetta_i18n_app|title }} › + {% blocktrans with rosetta_i18n_pofile.percent_translated|floatformat:2 as percent_translated %}Progress: {{ percent_translated }}%{% endblocktrans %} + {% if not rosetta_i18n_write %}{% trans "File is read-only: download the file when done editing!" %}{% endif %} +{% endblock %} +{% block pagetitle %}{% trans "English" %} - {{rosetta_i18n_lang_name}} ({{ rosetta_i18n_pofile.percent_translated|floatformat:0 }}%){% endblock %} +{% block main %} +

{% blocktrans %}Translate into {{rosetta_i18n_lang_name}}{% endblocktrans %}

+ + +
+
+ +
+ +
+ + + + {% rosetta_csrf_token %} + + {% if main_language %}{% endif %} + + + + + + + {% for message in messages %} + + {% if message.msgid_plural %} + + + {% else %} + + {% if main_language %}{% endif %} + + {% endif %} + + + + {% endfor %} + +
{% trans "Original" %}{{ main_language }}{{ rosetta_i18n_lang_name }}{% trans "Fuzzy" %}{% trans "Occurrences(s)" %}
+
+ {{message.msgid|format_message|linebreaksbr}} + {{message.msgid_plural|format_message|linebreaksbr}} +
+
+ {% for k, msgstr in message.msgstr_plural.items|dictsort:"0" %} + + + {% endfor %} + {{ message.msgid|format_message|linebreaksbr }}{{ message.main_lang|format_message|linebreaksbr }} + + {% if ENABLE_TRANSLATION_SUGGESTIONS %}{% trans "suggest" %}{% endif %} + + + + {% for fn,lineno in message.occurrences %} + {{ fn }}:{{lineno}} + {% endfor %} + {% if message.occurrences|length|gt:"3" %} + … ({% blocktrans count message.occurrences|length|minus:"3" as more_count %}{{more_count}} more{% plural %}{{more_count}} more{% endblocktrans %}) + {% endif %} +
+
+

+ {% if query %} + + {% endif %} + + + + {% if needs_pagination %} + {% trans "Skip to page:" %} + {% for i in page_range %} + {% ifequal i '...' %} + {{ i }} + {% else %} + {% ifequal i page %} + {{i}} + {% else %} + {{i}} + {% endifequal %} + {% endifequal %} + {% endfor %} + {% else %} + {% trans "Displaying:" %} + {% endif %} + {% blocktrans count rosetta_i18n_pofile|length as message_number and paginator.object_list|length as hits %}{{hits}}/{{message_number}} message{% plural %}{{hits}}/{{message_number}} messages{% endblocktrans %} + + +

+
+
+
+{% endblock %} diff --git a/pyweb/rosetta/templatetags/__init__.py b/pyweb/rosetta/templatetags/__init__.py new file mode 100644 index 0000000..76f7515 --- /dev/null +++ b/pyweb/rosetta/templatetags/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +""" + * Copyright (C) 2010, mbonetti + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. +""" + diff --git a/pyweb/rosetta/templatetags/rosetta.py b/pyweb/rosetta/templatetags/rosetta.py new file mode 100644 index 0000000..3d3a6e5 --- /dev/null +++ b/pyweb/rosetta/templatetags/rosetta.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +""" + * Copyright (C) 2010, mbonetti + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. +""" + +from django import template +from django.utils.safestring import mark_safe +from django.utils.html import escape +import re +from django.template import Node + +register = template.Library() +rx = re.compile(r'(%(\([^\s\)]*\))?[sd])') + +def format_message(message): + return mark_safe(rx.sub('\\1', escape(message).replace(r'\n','
\n'))) +format_message=register.filter(format_message) + + +def lines_count(message): + return 1 + sum([len(line)/50 for line in message.split('\n')]) +lines_count=register.filter(lines_count) + +def mult(a,b): + return int(a)*int(b) +mult=register.filter(mult) + +def minus(a,b): + try: + return int(a) - int(b) + except: + return 0 +minus=register.filter(minus) + + +def gt(a,b): + try: + return int(a) > int(b) + except: + return False +gt=register.filter(gt) + + +def is_fuzzy(message): + return message and hasattr(message, 'flags') and 'fuzzy' in message.flags +is_fuzzy = register.filter(is_fuzzy) + +class RosettaCsrfTokenPlaceholder(Node): + def render(self, context): + return mark_safe(u"") + +def rosetta_csrf_token(parser, token): + try: + from django.template.defaulttags import csrf_token + return csrf_token(parser,token) + except ImportError: + return RosettaCsrfTokenPlaceholder() +rosetta_csrf_token=register.tag(rosetta_csrf_token) diff --git a/pyweb/rosetta/urls.py b/pyweb/rosetta/urls.py new file mode 100644 index 0000000..4c6fa9e --- /dev/null +++ b/pyweb/rosetta/urls.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +""" + * Copyright (C) 2010, mbonetti + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. +""" + +from django.conf.urls.defaults import * +from django.views.generic.simple import direct_to_template +urlpatterns = patterns('rosetta.views', + url(r'^$', 'home', name='rosetta-home'), + url(r'^pick/$', 'list_languages', name='rosetta-pick-file'), + url(r'^download/$', 'download_file', name='rosetta-download-file'), + url(r'^select/(?P[\w\-]+)/(?P\d+)/$','lang_sel', name='rosetta-language-selection'), +) diff --git a/pyweb/rosetta/views.py b/pyweb/rosetta/views.py new file mode 100644 index 0000000..dad7329 --- /dev/null +++ b/pyweb/rosetta/views.py @@ -0,0 +1,322 @@ +# -*- coding: utf-8 -*- + +""" + * Copyright (C) 2010, mbonetti + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. +""" + +from django.conf import settings +from django.contrib.auth.decorators import user_passes_test +from django.core.paginator import Paginator, InvalidPage +from django.core.urlresolvers import reverse, resolve, Resolver404 +from django.http import Http404, HttpResponseRedirect, HttpResponse +from django.shortcuts import render_to_response +from django.utils.encoding import smart_unicode, force_unicode, iri_to_uri +from django.utils.translation import ugettext_lazy as _ +from django.views.decorators.cache import never_cache +from rosetta.polib import pofile +from rosetta.poutil import find_pos, pagination_range +from rosetta.conf import settings as rosetta_settings +import re, os, rosetta, datetime, unicodedata +from django.template import RequestContext + + +try: + resolve(settings.LOGIN_URL) +except Resolver404: + try: + resolve('/admin/') + except Resolver404: + raise Exception('Rosetta cannot log you in!\nYou must define a LOGIN_URL in your settings if you don\'t run the Django admin site at a standard URL.') + else: + LOGIN_URL = '/admin/' +else: + LOGIN_URL = settings.LOGIN_URL + + +def home(request): + """ + Displays a list of messages to be translated + """ + + def fix_nls(in_,out_): + """Fixes submitted translations by filtering carriage returns and pairing + newlines at the begging and end of the translated string with the original + """ + if 0 == len(in_) or 0 == len(out_): + return out_ + + if "\r" in out_ and "\r" not in in_: + out_=out_.replace("\r",'') + + if "\n" == in_[0] and "\n" != out_[0]: + out_ = "\n" + out_ + elif "\n" != in_[0] and "\n" == out_[0]: + out_ = out_.lstrip() + if "\n" == in_[-1] and "\n" != out_[-1]: + out_ = out_ + "\n" + elif "\n" != in_[-1] and "\n" == out_[-1]: + out_ = out_.rstrip() + return out_ + + version = rosetta.get_version(True) + if 'rosetta_i18n_fn' in request.session: + rosetta_i18n_fn=request.session.get('rosetta_i18n_fn') + rosetta_i18n_app = get_app_name(rosetta_i18n_fn) + rosetta_i18n_pofile = request.session.get('rosetta_i18n_pofile') + rosetta_i18n_lang_code = request.session['rosetta_i18n_lang_code'] + rosetta_i18n_lang_bidi = (rosetta_i18n_lang_code in settings.LANGUAGES_BIDI) + rosetta_i18n_write = request.session.get('rosetta_i18n_write', True) + + if 'filter' in request.GET: + if request.GET.get('filter') in ('untranslated', 'translated', 'fuzzy', 'all'): + filter_ = request.GET.get('filter') + request.session['rosetta_i18n_filter'] = filter_ + return HttpResponseRedirect(reverse('rosetta-home')) + + rosetta_i18n_filter = request.session.get('rosetta_i18n_filter', 'all') + + if '_next' in request.POST: + rx=re.compile(r'^m_([0-9]+)') + rx_plural=re.compile(r'^m_([0-9]+)_([0-9]+)') + file_change = False + for k in request.POST.keys(): + if rx_plural.match(k): + id=int(rx_plural.match(k).groups()[0]) + idx=int(rx_plural.match(k).groups()[1]) + rosetta_i18n_pofile[id].msgstr_plural[str(idx)] = fix_nls(rosetta_i18n_pofile[id].msgid_plural[idx], request.POST.get(k)) + file_change = True + elif rx.match(k): + id=int(rx.match(k).groups()[0]) + rosetta_i18n_pofile[id].msgstr = fix_nls(rosetta_i18n_pofile[id].msgid, request.POST.get(k)) + file_change = True + + if file_change and 'fuzzy' in rosetta_i18n_pofile[id].flags and not request.POST.get('f_%d' %id, False): + rosetta_i18n_pofile[id].flags.remove('fuzzy') + elif file_change and 'fuzzy' not in rosetta_i18n_pofile[id].flags and request.POST.get('f_%d' %id, False): + rosetta_i18n_pofile[id].flags.append('fuzzy') + + if file_change and rosetta_i18n_write: + + try: + rosetta_i18n_pofile.metadata['Last-Translator'] = unicodedata.normalize('NFKD', u"%s %s <%s>" %(request.user.first_name,request.user.last_name,request.user.email)).encode('ascii', 'ignore') + rosetta_i18n_pofile.metadata['X-Translated-Using'] = u"django-rosetta %s" % rosetta.get_version(False) + rosetta_i18n_pofile.metadata['PO-Revision-Date'] = datetime.datetime.now().strftime('%Y-%m-%d %H:%M%z') + except UnicodeDecodeError: + pass + try: + rosetta_i18n_pofile.save() + rosetta_i18n_pofile.save_as_mofile(rosetta_i18n_fn.replace('.po','.mo')) + + # Try auto-reloading via the WSGI daemon mode reload mechanism + if rosetta_settings.WSGI_AUTO_RELOAD and \ + request.environ.has_key('mod_wsgi.process_group') and \ + request.environ.get('mod_wsgi.process_group',None) and \ + request.environ.has_key('SCRIPT_FILENAME') and \ + int(request.environ.get('mod_wsgi.script_reloading', '0')): + try: + os.utime(request.environ.get('SCRIPT_FILENAME'), None) + except OSError: + pass + + except: + request.session['rosetta_i18n_write'] = False + + request.session['rosetta_i18n_pofile']=rosetta_i18n_pofile + + # Retain query arguments + query_arg = '' + if 'query' in request.REQUEST: + query_arg = '?query=%s' %request.REQUEST.get('query') + if 'page' in request.GET: + if query_arg: + query_arg = query_arg + '&' + else: + query_arg = '?' + query_arg = query_arg + 'page=%d' % int(request.GET.get('page')) + + + return HttpResponseRedirect(reverse('rosetta-home') + iri_to_uri(query_arg)) + + + rosetta_i18n_lang_name = _(request.session.get('rosetta_i18n_lang_name')) + rosetta_i18n_lang_code = request.session.get('rosetta_i18n_lang_code') + + if 'query' in request.REQUEST and request.REQUEST.get('query','').strip(): + query=request.REQUEST.get('query').strip() + rx=re.compile(query, re.IGNORECASE) + paginator = Paginator([e for e in rosetta_i18n_pofile if rx.search(smart_unicode(e.msgstr)+smart_unicode(e.msgid)+u''.join([o[0] for o in e.occurrences]))], rosetta_settings.MESSAGES_PER_PAGE) + else: + if rosetta_i18n_filter == 'untranslated': + paginator = Paginator(rosetta_i18n_pofile.untranslated_entries(), rosetta_settings.MESSAGES_PER_PAGE) + elif rosetta_i18n_filter == 'translated': + paginator = Paginator(rosetta_i18n_pofile.translated_entries(), rosetta_settings.MESSAGES_PER_PAGE) + elif rosetta_i18n_filter == 'fuzzy': + paginator = Paginator(rosetta_i18n_pofile.fuzzy_entries(), rosetta_settings.MESSAGES_PER_PAGE) + else: + paginator = Paginator([e for e in rosetta_i18n_pofile if not e.obsolete], rosetta_settings.MESSAGES_PER_PAGE) + + if 'page' in request.GET and int(request.GET.get('page')) <= paginator.num_pages and int(request.GET.get('page')) > 0: + page = int(request.GET.get('page')) + else: + page = 1 + messages = paginator.page(page).object_list + if rosetta_settings.MAIN_LANGUAGE and rosetta_settings.MAIN_LANGUAGE != rosetta_i18n_lang_code: + + main_language = None + for language in settings.LANGUAGES: + if language[0] == rosetta_settings.MAIN_LANGUAGE: + main_language = _(language[1]) + break + + fl = ("/%s/" % rosetta_settings.MAIN_LANGUAGE).join(rosetta_i18n_fn.split("/%s/" % rosetta_i18n_lang_code)) + po = pofile(fl) + + main_messages = [] + for message in messages: + message.main_lang = po.find(message.msgid).msgstr + + needs_pagination = paginator.num_pages > 1 + if needs_pagination: + if paginator.num_pages >= 10: + page_range = pagination_range(1, paginator.num_pages, page) + else: + page_range = range(1,1+paginator.num_pages) + ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX + ENABLE_TRANSLATION_SUGGESTIONS = rosetta_settings.ENABLE_TRANSLATION_SUGGESTIONS + + return render_to_response('rosetta/pofile.html', locals(), context_instance=RequestContext(request)) + + + else: + return list_languages(request) +home=user_passes_test(lambda user:can_translate(user),LOGIN_URL)(home) +home=never_cache(home) + + +def download_file(request): + import zipfile, os + from StringIO import StringIO + # original filename + rosetta_i18n_fn=request.session.get('rosetta_i18n_fn', None) + # in-session modified catalog + rosetta_i18n_pofile = request.session.get('rosetta_i18n_pofile', None) + # language code + rosetta_i18n_lang_code = request.session.get('rosetta_i18n_lang_code', None) + + if not rosetta_i18n_lang_code or not rosetta_i18n_pofile or not rosetta_i18n_fn: + return HttpResponseRedirect(reverse('rosetta-home')) + try: + if len(rosetta_i18n_fn.split('/')) >= 5: + offered_fn = '_'.join(rosetta_i18n_fn.split('/')[-5:]) + else: + offered_fn = rosetta_i18n_fn.split('/')[-1] + po_fn = str(rosetta_i18n_fn.split('/')[-1]) + mo_fn = str(po_fn.replace('.po','.mo')) # not so smart, huh + zipdata = StringIO() + zipf = zipfile.ZipFile(zipdata, mode="w") + zipf.writestr(po_fn, str(rosetta_i18n_pofile)) + zipf.writestr(mo_fn, rosetta_i18n_pofile.to_binary()) + zipf.close() + zipdata.seek(0) + + response = HttpResponse(zipdata.read()) + response['Content-Disposition'] = 'attachment; filename=%s.%s.zip' %(offered_fn,rosetta_i18n_lang_code) + response['Content-Type'] = 'application/x-zip' + return response + except Exception, e: + return HttpResponseRedirect(reverse('rosetta-home')) + +download_file=user_passes_test(lambda user:can_translate(user),LOGIN_URL)(download_file) +download_file=never_cache(download_file) + + + +def list_languages(request): + """ + Lists the languages for the current project, the gettext catalog files + that can be translated and their translation progress + """ + languages = [] + do_django = 'django' in request.GET + do_rosetta = 'rosetta' in request.GET + has_pos = False + for language in settings.LANGUAGES: + pos = find_pos(language[0],include_djangos=do_django,include_rosetta=do_rosetta) + has_pos = has_pos or len(pos) + languages.append( + (language[0], + _(language[1]), + [(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], + ) + ) + ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX + version = rosetta.get_version(True) + return render_to_response('rosetta/languages.html', locals(), context_instance=RequestContext(request)) +list_languages=user_passes_test(lambda user:can_translate(user),LOGIN_URL)(list_languages) +list_languages=never_cache(list_languages) + +def get_app_name(path): + app = path.split("/locale")[0].split("/")[-1] + return app + +def lang_sel(request,langid,idx): + """ + Selects a file to be translated + """ + if langid not in [l[0] for l in settings.LANGUAGES]: + raise Http404 + else: + + do_django = 'django' in request.GET + do_rosetta = 'rosetta' in request.GET + + file_ = find_pos(langid,include_djangos=do_django,include_rosetta=do_rosetta)[int(idx)] + + request.session['rosetta_i18n_lang_code'] = langid + request.session['rosetta_i18n_lang_name'] = unicode([l[1] for l in settings.LANGUAGES if l[0] == langid][0]) + request.session['rosetta_i18n_fn'] = file_ + po = pofile(file_) + for i in range(len(po)): + po[i].id = i + + request.session['rosetta_i18n_pofile'] = po + try: + os.utime(file_,None) + request.session['rosetta_i18n_write'] = True + except OSError: + request.session['rosetta_i18n_write'] = False + + return HttpResponseRedirect(reverse('rosetta-home')) +lang_sel=user_passes_test(lambda user:can_translate(user),LOGIN_URL)(lang_sel) +lang_sel=never_cache(lang_sel) + +def can_translate(user): + if not user.is_authenticated(): + return False + elif user.is_superuser: + return True + else: + try: + from django.contrib.auth.models import Group + translators = Group.objects.get(name='translators') + return translators in user.groups.all() + except Group.DoesNotExist: + return False diff --git a/pyweb/settings.py b/pyweb/settings.py index cc0e80e..a366eeb 100644 --- a/pyweb/settings.py +++ b/pyweb/settings.py @@ -190,4 +190,5 @@ INSTALLED_APPS = ( 'django.contrib.sites', 'registration', 'mumble', + 'rosetta', )