in reply to regex for translation

I need to somehow let regex match first part of the code as translation string and second (everything after '",') as parameters and then replace them in the sentense

If I'm understanding correctly the problem... in pseudocode: If found (something), replace $1; save $POSTMATCH (linked to the match?) and do something with it

Seems a job for a %hash{item} = "translation" to me, where translation could be maybe an array of options?

As number of tags is, probably, limited you could check and validate only for some predefined values. If those names are well defined you don't need probably to care for saving the ("") envelopment.

Replies are listed 'Best First'.
Re^2: regex for translation
by klayman (Initiate) on Oct 03, 2013 at 07:26 UTC
    Yes thats how it is used at the moment. Simple translation string may be __('here is something') and %hash{'here is something'} = translation in specific language. This works fine. Problem arise if i introduce more complicated translations where I can replace internal words in the translated sentence (like word 'something') where am not aware how many specific words can be replace in the sentence where sentence 'here is something' can be 'here is anything' or 'here is nothing' or 'here is the thing'.