Re: translations - cross post. maybe this is a better place to discuss this :)

2007-01-23 Thread nesh
of Django after all ;) OK, I'll reply there. -- Nebojša Đorđević - nesh, ICQ#43799892 Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 282159 [http://counter.li.org] --~--~-~--~~~---~--~~

Re: translations - cross post. maybe this is a better place to discuss this :)

2007-01-23 Thread nesh
* [EMAIL PROTECTED] wrote, On 23.01.2007 10:49: > nesh napisał(a): >> I'm -1 on this, translation must be done *without* any changes to the model. > I'm -1 on that -1 :) >> IMHO, best place to translate content is in the template -- at the point of >>

Re: translations - cross post. maybe this is a better place to discuss this :)

2007-01-23 Thread nesh
e > solutions come out, the resources for both should be in one place and > should not require more from the developer than an import from > contrib.il8n.thissolution to be able to implement them. I know, all of my projects are (at least) in two languages ;) -- Nebo

Re: translations - cross post. maybe this is a better place to discuss this :)

2007-01-23 Thread nesh
mplementation add this to the django contrib. I'm planning to do more serious work on translations in the next week, so stay tuned. -- Nebojša Đorđević - nesh, ICQ#43799892 Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 2821

Re: validation-aware models: status/plans?

2007-01-16 Thread nesh
to the validate method in the save() to prevent saving model with invalid data like this: ... def save(self): errors = self.validate() if len(errors): raise validators.ValidationError ... super(Model, self).save() # save data to the database -- Neboj�a or e

Re: Moving towards Django 1.0

2007-01-15 Thread nesh
evi - nesh, ICQ#43799892 Studio Quattro - Ni� - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 282159 [http://counter.li.org] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Exceptions inside model functions

2006-02-28 Thread nesh
) to, at least, get some indication (as a text returned from function) when error is occurred. Any solutions or plans for this? p.s. I move some of my new projects to m-r branch so I can (hopefully) provide some feedback (and patches) soon. -- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG

[magic-removal] How to create related table from field

2006-02-27 Thread nesh
Foo model and a additional table like this: class i18n_for_foo(models.Model): parent = models.ForeignKey(Foo, edit_inline=True) language = ... text = ... If I understood docs correctly this is now possible in m-r branch. Help, pointers anyone? -- Nebojša Đorđević - n

[magic-removal] New field type creation

2005-12-19 Thread Nebojša Đorđević - nesh
e__ = "I18N_%s_%s" % (id_from, self.name) I18NC._meta.module_name = ("I18N_%s_%s" % (id_from, self.name)).lower() + 's' # # Is this is right way to make a new filed? --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djn

Re: Magic removal stuff...

2005-12-17 Thread Nebojša Đorđević - nesh
magic-removal work! Great stuff, I just now got a time to go through the code and I'm amazed. Finally it will be possible to make *real* custom fields (i.e. my thumbnails stuff, i18n-aware fields). Great! --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspo

Re: save/delete/etc hooks for custom fields

2005-12-02 Thread Nebojša Đorđević - nesh
On 2005-12-02, at 8:54 CET, Nebojša Đorđević - nesh wrote: Well it can be a little less horrible if we use a decorator (2.4) syntax: Huh? Why this don't work: def thumbnail_cleanup(post_delete=None): def new_post_delete(self): from nesh.thumbnails.utils import remove_thumb

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
): @cleanup_thumbnails def _post_delete(self): ... And we can get away without a _post_save because ImageField has a save_file method that can be overridden to implement a _post_save functionality. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
th overriding a save_file method. Or maybe, for now is just easier to put the same (and boring) piece of code in models _post_save/delete methods for all models which requires a thumbnail support. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ |

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 18:57 CET, Nebojša Đorđević - nesh wrote: OK, but can we make more thumbnails of different sizes from one image simultaneously? Thumbnails are generated on the first request from template (i.e ). You can pre- generate some sizes in model _post_save if you want. OTOH

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 18:52 CET, Nebojša Đorđević - nesh wrote: Details follows I forgot. Just unpack .zip somewhere in your PYTHONPATH to use it. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
e some sizes in model _post_save if you want. And can we add options for image decorations? (shadow, watermark, etc. that PIL allows) This is the matter of just adding a new tags or filters to library. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djn

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
same directory as a original file with following filename pattern: _t[][_h]. (this is following thumbnail naming scheme found in admin). --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
must keep a patched version of the trunk until event framework emerges. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
anging __init__.py) to me to hook-up with the model delete method? --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
ype of save/delete/etc hooks for fields and get rid of 'if isinstance(f, foo)' stuff? BTW from __init__.py:806: #TODO : change this into a virtual function so that user defined fields will be able to add methods to module or class. --- Nebojša Đorđević - nesh Studio Qu

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
will just need to ask for thumbnail of required size and it will be auto- magically generated for you (PIL is required), same with object deletion. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 2

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
main trunk. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: Smarter cache

2005-12-01 Thread Nebojša Đorđević - nesh
On 1-12-2005, at 7:31, [EMAIL PROTECTED] wrote: So, are you interested in PHP realization with main idea explained? Yes --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http

Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
:"top=|left=|w=|h=" - crop image from (top, left) position to size (width, height). * {% image_size as w, h %} - store image size in w and h variables in current context. * |image_width, |image_height - as alternative to above Any opinions? --- Nebojša Đorđević - nesh Studi

Re: Smarter cache

2005-11-30 Thread Nebojša Đorđević - nesh
ition/edit/deletion. When I'm faced with this problem I just put some type of cache invalidation function in _post_save of related object. OTOH it will be a great addition to have some type of general listener interface for database object add/change/delete/... --- Nebojša Đorđević - nesh

Re: Multi-language support in Django

2005-11-25 Thread Nebojša Đorđević - nesh
UAGES] elif not isinstance(alt_loc, (tuple, list)): alt_loc = [alt_loc] # if 'en' not in alt_loc: alt_loc.append('en') # for loc in alt_loc: try: kwargs = {'%s__exact' % locale_field: loc} obj = func(**kwargs) text = getattr(obj, text_field) cl = loc break except ObjectDoesNotExist: pass # for if (text is None) or (not text.strip()): return fallback return text # get_for_lang --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: Ditch pluralisation entirely

2005-11-24 Thread Nebojša Đorđević - nesh
#x27;plural', n) because otherwise we will allways have this problem with wrong pluralizations in i18n projects. The current situation only works with languages where you have singular and plural - but there are many different concepts of pluralization. +1 great idea! --- Nebojša Đorđević - nesh

Re: MySQL character set problem

2005-11-16 Thread Nebojša Đorđević - nesh
return base.CursorDebugWrapper(MysqlDebugWrapper (self.connection.cursor()), self) return self.connection.cursor() --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: MySQL character set problem

2005-11-16 Thread Nebojša Đorđević - nesh
On 16-11-2005, at 13:12, Radek Svarz wrote: There are diffs between 4.0.x 4.1.x and 5. My local version is MySQL 4.0.23_Debian-3ubuntu2.1-log and TextDrive is using MySQL 4.1.14-log, and probably that is a problem. Any solutions? --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG

MySQL character set problem

2005-11-16 Thread Nebojša Đorđević - nesh
ction to counter this to force connection to use 'utf-8'. Any ideas? --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: i18n branch has been merged to trunk

2005-11-05 Thread Nebojša Đorđević - nesh
l problems. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: i18n branch proposal: syntax change for templates

2005-11-03 Thread Nebojša Đorđević - nesh
f my projects. Great work :) --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: i18n branch proposal: syntax change for templates

2005-11-03 Thread Nebojša Đorđević - nesh
--- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: lets merge i18n back into trunk

2005-11-02 Thread Nebojša Đorđević - nesh
\ plural=n%10==1 && n%100!=11 ? 0 : \ n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2; Languages with this property include: Slavic family Croatian, Czech, Russian, Slovak, Ukrainian ... --- Nebojša Đorđević - nesh Studio Q

Re: lets merge i18n back into trunk

2005-11-02 Thread Nebojša Đorđević - nesh
ather complex Some examples at http://www.gnu.org/software/gettext/manual/ html_chapter/gettext_10.html#SEC150. And yes, python gettext fully supports plural expressions. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

[i18n] [patch] django-admin.py is broken when DJANGO_SETTINGS_MODULE in env is not set

2005-10-20 Thread Nebojša Đorđević - nesh
+ # Run the appropriate action. Unfortunately, optparse can't handle # positional arguments, so this has to parse/validate them. try: --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: language normalization

2005-10-12 Thread Nebojša Đorđević - nesh
er don't even bother to set-up their browser right so (as Laslo Martins said in another thread) most of the time I'll will resort to some of "click-the-flag system" and for that I can use any language code I want. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG htt

[i18n] language normalization

2005-10-11 Thread Nebojša Đorđević - nesh
E.ISO8859-1', 'de_DE', 'de.ISO8859-1', 'de'] >>> _expand_lang('sr_latin') ['sr_latin', 'sr'] >>> _expand_lang('sr_cyrillic') ['sr_cyrillic', 'sr'] --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: i18n -- DRAFT

2005-10-11 Thread Nebojša Đorđević - nesh
ll post all relevant info here (and patches if any). Best way for online discussion would be the #django IRC channel on freenode.net, as that a) is visited by me quite often and b) is publicly logged for later reference. Agreed. - --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djne

Re: i18n -- DRAFT

2005-10-11 Thread Nebojša Đorđević - nesh
On 11-10-2005, at 13:24, Nebojša Đorđević - nesh wrote: Hey C8E, maybe I'm missed but I just found out that you registered django on roseta (https://launchpad.net/products/django) :). When we can use this to make django translation repository? --- Nebojša Đorđević - nesh Studio Qu

Re: i18n -- DRAFT

2005-10-11 Thread Nebojša Đorđević - nesh
On 11-10-2005, at 13:08, Petar Marić wrote: Offtopic: I think it's for the best to recode the current translation file to cyrillic, because we can use automated tools to make latin translation out of that. Saves quite a some time. If it's allright with you nesh, I would get r

Re: i18n -- DRAFT

2005-10-11 Thread Nebojša Đorđević - nesh
On 11-10-2005, at 12:06, Nebojša Đorđević - nesh wrote: This is little off-topic. I'm looking to make both Serbian translations (latin and cyrillic). But, I'm failed to found any reference to _standard_ codes for that. Only idea I have is to make two codes - sr_LAT and sr_CYR

Re: i18n -- DRAFT

2005-10-11 Thread Nebojša Đorđević - nesh
do copy & paste every-time when I need them. update: I looked at the model sources and I admit that I'm lost :( My starting point are ManyToMany field, but I failed to understand how to do it). Can someone post some examples (or better documentation) how to do this type of stuff?

Re: i18n -- DRAFT

2005-10-11 Thread Nebojša Đorđević - nesh
On 11-10-2005, at 11:33, Nebojša Đorđević - nesh wrote: from make_messages.py: if file.endswith('.html'): src = open(os.path.join(dirpath, file), "rb").read() open(os.path.join(dirpath, '%s.py' % file),

Re: i18n -- DRAFT

2005-10-11 Thread Nebojša Đorđević - nesh
t.com/ wiki/InterNationalization page to reflect current status for i18n branch and, maybe, add docs from translation.txt somewhere on the wiki. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159

Re: i18n -- DRAFT

2005-10-05 Thread Nebojša Đorđević - nesh
e) from object based on current selected language. I'm found while writing current application that this pattern is very common (almost a 2/3 of my models are using some type of localized name/description fields) and it will be great that i18n/model framework supports tha

Re: i18n -- DRAFT

2005-10-04 Thread Nebojša Đorđević - nesh
ave enough time to write i18n stuff right, so it's great that someone do it for me :) --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: i18n -- DRAFT

2005-10-03 Thread Nebojša Đorđević - nesh
On 3-09-2005, at 11:29, Nebojša Đorđević - nesh wrote: Also I added LANGUAGE_CODE and LANGUAGES to DjangoContext I'm forget to say that LANGUAGES will be in model choices format, i.e.: LANGUAGES = (('en', 'English'), ('sr', 'Srpski')

Re: i18n -- DRAFT

2005-10-01 Thread Nebojša Đorđević - nesh
) And that's is great, I'm just started to think that no one but me is interested in i18n part of the django :). tag.diff Description: Binary data --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: i18n -- DRAFT

2005-09-12 Thread Nebojša Đorđević - nesh
rently without translated admin interface (I don't have time to do that for now - deadline is closing :( ), but all other parts of the site are fully i18n-ized. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: i18n -- DRAFT

2005-08-18 Thread Nebojša Đorđević - nesh
On 11-08-2005, at 11:39, Nebojša Đorđević - nesh wrote: set_translation(languages, app_name=None) - Sets *global* translation via get_translation() current_translation() - Returns current *global* translation *gettext functions

Re: i18n -- DRAFT

2005-08-17 Thread Nebojša Đorđević - nesh
On 11-08-2005, at 11:39, Nebojša Đorđević - nesh wrote: This is done calling setup_locale() from HttpRequest inside *Request constructor because *Request classes don't call base class (HttpRequest) constructor. Update: I just found-out that this is not correct way to do it :( When I t

i18n -- DRAFT

2005-08-11 Thread Nebojša Đorđević - nesh
', '%(foo)d plural', foo) %} Usage: == Django core will be using top level gettext aliases to global translation object. Applications will create it's own translation objects or will be using supplied translation object from request. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG

Re: i18n -- let's do it!

2005-08-04 Thread Nebojša Đorđević - nesh
On 3-08-2005, at 14:23, Ksenia Marasanova wrote: I didn't digget into it yet but it looks like the solution is do not use "install()" method. http://barry.warsaw.us/papers/mailman-freenix-2003/node8.html And here is implementation - put files in django/core/i18n or similar. Usage: set_languag

Re: i18n -- let's do it!

2005-08-03 Thread Nebojša Đorđević - nesh
On 3-08-2005, at 12:25, Moof wrote: Havign had a closer look at the gettext module: It sucks for what we want to use it for. I think we may need to end up defining our own subclass of string. The gettext format is fine, and I suggest we keep to that, but don't use the standard gettext pro

Re: i18n -- let's do it!

2005-08-03 Thread Nebojša Đorđević - nesh
On 3-08-2005, at 1:05, Moof wrote: By "not threadsafe" it means that settign the locale is a global thing. So you can't have two threads with different locales, and you mgiht end up changing locale half way though the execution of a locale-dependent method. Also, from experience, setloc

Re: i18n -- let's do it!

2005-08-02 Thread Nebojša Đorđević - nesh
On 2-08-2005, at 16:46, Ksenia Marasanova wrote: -1 It's my first i18n experience, but I think it's better to stick to an accepted standard here. I agree, after a day of digging through the net and gettext documentation I think that gettext way is the right way :). And another question:

Re: i18n -- let's do it!

2005-08-02 Thread Nebojša Đorđević - nesh
OTOH, maybe we can go for database based solution like some PHP CMS I seen? This is, maybe, more user-friendlier way? Good thing is that users can change messages within admin interface, no need for external software on the server (for online editing of translations) and all apps can hav