RenameRTFM: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
 
(No difference)

Latest revision as of 15:36, 6 April 2016

How to rename RTFM?

Everyone on this site knows that RTFM stands for ''Request Tracker Faq Manager'', but how many of your customers know it? The following script permits to change all RTFM strings in translation files (rt/local/plugins/RT-FM/po/*.po) to ''FAQ''. It can help you to push forward RT + RTFM adoption.

#!/usr/bin/perl -w
 #
 # Example script that renames RTFM to FAQ in po files
 #
 # rtfm2faq.pl es.po > es.po2
 # mv es.po2 es.po
 
 use strict;
 
 my ($msgstr, $msgid);
 while (my $l = <>)
 {
     # No string that takes more than one line
     unless ($l =~ /(msgstr|msgid) "(.*?)"\s*$/) {
         print $l;
         next;
     }
 
     if ($1 eq 'msgid') {
         $msgid = $2;
         $msgstr= '';
         print $l;
         next;
     }
 
     $msgstr = $2;
 
     if (!$msgstr && $msgid =~ m/RTFM/) {
         $msgstr = $msgid;
     }
     $msgstr =~ s/RTFM/FAQ/g;
     print "msgstr \"$msgstr\"\n";
 }