Bibletime – a bible study tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

75 lines
1.6 KiB

  1. #! /usr/bin/perl
  2. # NOTE: this script is part of the KDE SDK and added to KDevelop to support KDE 2 application development.
  3. # The original is located in the KDE CVS module tdesdk/scripts. It gets installed in the same directory as
  4. # the KDevelop binary to be in your PATH.
  5. #
  6. # What it does is extract the strings in an application´s .rc file, e.g. testappui.rc, and writes into the pot file
  7. # where the translations are build with (po-files)
  8. #
  9. # Added to KDevelop 2000-10-29, Ralf Nolden (nolden@kde.org)
  10. $linenr = 0;
  11. $filename = "";
  12. @filenames = ();
  13. sub writeoutstring($)
  14. {
  15. print STDOUT "i18n(\"@_[0]\");\n";
  16. }
  17. while (defined ($ARGV[0]))
  18. {
  19. $_ = shift;
  20. $filename = $_; # maybe check for options
  21. if (! $filename) {
  22. print STDERR "no file to open\n";
  23. exit 1;
  24. }
  25. $string = "";
  26. $intext = 0;
  27. open(FILE, $filename);
  28. while ( <FILE> ) {
  29. $linenr++;
  30. $string .= $_;
  31. chomp($string);
  32. $textstring = '([tT][eE][xX][tT]|string)>';
  33. if ($intext == 0) {
  34. if ($string =~ /<$textstring/) {
  35. $string =~ s/^.*<$textstring//;
  36. $intext = 1;
  37. $starting_linenr = $linenr;
  38. } else {
  39. $string = "";
  40. }
  41. }
  42. if (($intext == 1) && ($string =~ /<\/$textstring/)) {
  43. my $text = $string;
  44. $text =~ s/<\/$textstring.*$//;
  45. $text =~ s/&lt;/</g;
  46. $text =~ s/&gt;/>/g;
  47. $text =~ s/&amp;/&/g;
  48. writeoutstring($text);
  49. $string =~ s/^.*<\/$textstring//;
  50. $intext = 0;
  51. if ($linenr != $starting_linenr) {
  52. print STDERR "there is <text> floating\n";
  53. }
  54. }
  55. }
  56. if ($intext == 1) {
  57. print STDERR "parsing error in $filename $linenr\n";
  58. exit 1;
  59. }
  60. }