ForumNewsMembersSearchRegisterMember LoginFree Forum!


Neuer Thread ...


AuthorTopics » Book an abo for this threadClose Thread Move Thread Fix the thread Print view Delete this thread

jkohen ...



...

Status:Offline
Date registered: 26.02.2007
Post:2
Send Message
...   Created on 01.03.2007 - 20:39Jump to top Quote this post Report this post Edit Delete


I created a small Perl script to add audio indexes to game translations. This was done on request of Le Woltaire, who suggested I should post it here.

He says it's useful when you've finished your game and then you realize how wonderful it would be to dub it, but you don't want to manually index over a thousand lines of dialogue.

To run this you need a Perl interpreter and the translation source. E.g.: perl trans2dub translation_source.txt > dubbed_source.txt

Feel free to use and share. Any comments are welcome.

I'm considering writing some scripts to convert AGS translations to and from GNU PO format. Then I'd be in seventh heaven with EMACS' po-mode when working on the next translation ;-) I might start working on them earlier if I meet some interest from the community, since I don't know when I'll be next working on a translation.

Code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
 

#!/usr/bin/perl -w
#
# Assigns sequential numeric indexes to translated text so that it can
# be used for audio dubbing.
#
# Invocation: perl trans2dub translation_source.txt > dubbed_source.txt
#
# Author: Javier Kohen <jkohen@users.sourceforge.net>
# Hereby donated to the public domain.
# Please notify me of any improvements you make to this script.
#
# Last update: 2007-03-01 16:30Z

use strict;

# BOBBY: A conversation topic. These shouldn't be modified.
my $conv_topic = '^[a-z, ]*$';

# Allows to filter lines by content.
#
# You can add your own text-specific filter criteria here.  SRC
# contains the untranslated line and TR contains the corresponding
# translation.
#
# Returning non-zero will give the current line an audio index.
sub content_filter($$) {
    my ($src, $tr) = (shift, shift);

    return not $src =~ /$conv_topic/;
}

## End of per-game customizations section.


# Indicates the start of a block containing messages we are interested
# in dubbing.
my $make = '^\/\/ \*\*\*\* (?:(?:.* MESSAGES|STRINGS FROM THE GLOBAL SCRIPT) ARE BELOW|LINES ADDED IN UPDATE AT .*) \*\*\*\*$';

# Indicates a section change.
my $break = '^\/\/ \*\*\*\*';

my $capturing = 0;
my $pos = 0; # Oscillates back and forth to indicate source text or translation.
my $n = 1;
my $prev = '';

while (<>) {
    if (/$break/) {
    $capturing = 0;
    }

    if ($capturing) {
    if ((1 & $pos) && content_filter($prev, $_)) {
        if (length() <= 1) {
        # Empty line. Duplicate previous.
        $_ = $prev;
        }

        print "&$n ";
        $n++;
    }

    $pos ^= 1;
    }

    if (/$make/) {
    $capturing = 1;
    $pos = 0;
    }

    print;

    $prev = $_;
}




Le_Woltaire ...
Administrator
...............

...

Status:Offline
Date registered: 21.02.2007
Post:89
Send Message
...   Created on 02.03.2007 - 21:05Jump to top Quote this post Report this post Edit Delete


The script can be downloaded at my downloads page:

http://spectrum.sitesled.com/downloads.html

For what is the script useful:

-People who have a finished AGS translation file and want to add dub indexes afterwards.

-Independent voice acting groups, who ask a game creator if they could make a voice acting of a game that was created with AGS. The game creator doesn't want to autonumber his game or to give the source code away so he simply sends a blank translation source to them. They use the PERL script on it and have a translation file with audio indexes.

-After compiling the translation the voice pack can be distributed independently as a vox and tra file.

[Dieser Beitrag wurde am 03.03.2007 - 20:51 von Le_Woltaire aktualisiert]





Signature


Neuer Thread ...

Birthdays:
There are no birthday children today!
----------------------------------




Masthead

This forum is a free service of razyboard.com
Do you want a free forum in less than two minutes? Then click here!



blank