Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: regex for translation

by pvaldes (Chaplain)
on Oct 02, 2013 at 13:47 UTC ( [id://1056612]=note: print w/replies, xml ) Need Help??


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'.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1056612]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-25 18:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found