[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Maposmatic-dev] A proposal to solve the translation problem

From: Jeroen van Rijn
Subject: Re: [Maposmatic-dev] A proposal to solve the translation problem
Date: Thu, 5 Apr 2012 23:32:30 +0200

On Thu, Apr 5, 2012 at 23:07, Thomas Petazzoni <address@hidden> wrote:
So we would have to actually instantiate each of the stylesheet classes
in order to just get their name and description? Sounds odd.

On the other hand, the way we currently do it for renderers, where the
name and description are defined as class variables looks better to me,
but doesn't play well with translation: the _() function is not
available until a gettext context has been put in place, so _() cannot
be used on class variables.

Wouldn't mocking _() work? I'm thinking this:
- The function doesn't actually need to work to build the .po files. It just looks for _().
- At the point where OCitySMap actually needs the translation, gettext will have been imported and overwritten the mocked _()
- If in the former step the mocked _() persists in the instantiated class, some meta programming could replace the class's pointer to the mock _() with a pointer to the real function.
I had a quick look at that tonight, and I don't see how to solve the
problem. Would anyone have a bit of time to work on this? I will be
offline this week-end and will therefore not be able to work on this.



I'm willing to try and build a stand-alone proof of concept, if you think that might work.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]