Need to have a script, can be in PHP, Perl or a shell script to convert some text strings that appear in a file. They may appear any number of times in the text file
The basic pattern is <!--[gt ]--> inside there we can expect to see several params
domain, text, plural, count, category, html, tag
<!--[gt text='hello']--> or <!--[gt text='apple' plural='apples' count='2']-->
Quotation may be with single or double quotes. The parameters can appear in any order. You only need to parse text, plural, and count
if plural is not present we need to replace the occurrence with <?php g('text'); ?>
if plural us present we need to replace the string with <?php ng('text', 'plural', 'count'); ?>
the words text, plural and count refer to the value of those parameters.
So a full example:
<!--[gt text='hello']-->anything in between <!--[gt text='apple' plural="apples" count=2]-->
<!--[gt text="hello %s" tag="name"]--> more stuff<!--[gt plural="apples for %s" text='apple for %s' tag='you' html=1 count=2]-->more text and maybe some html etc.
<?php g('hello'); ?>anything in between <?php ng('apple', 'apples', 2); ?>
<?php g('hello %s'); ?> more stuff<?php ng('apple for %s', 'apples for %s', 2); ?>more text and maybe some html etc.
Notice that the order when we translate is important for plurals, because we replace in the form ng(text, plural, count) even if the order was mixed up. Notice how we disregard all the other possible params.
The solution must be either a php script, perl script or shell script. Just needs to be able to read a file and output the file... nothing fancy and no interface at all. if writing in a PHP script just file_get_contents and file_put_contents is enough.
12 freelanceria on tarjonnut keskimäärin 58 $ tähän työhön
I am interested to your project. I am a Web Developer with extensive experience PERL I have 8 years of experience in software design and development web-based cross-browser and cross-platform systems. Thanks
I am very much comfortable with Perl. So i think i can complete this within 1 day itself.But since i need to test it aganist various testcase i need half day more.
I am very much familiar with perl. Having 8 years experience in perl. Good in regular expression. Having experience in perl/cgi, mod_perl based web applications. I will complete this work within a day.