| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Getopt::Long; | ||
| 7 | use Pod::Usage; | ||
| 8 | use IO::All -utf8; | ||
| 9 | |||
| 10 | use HON::I18N::Converter; | ||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | build-properties-JS-file.pl | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | Convert an excel i18n file to jQuery i18n plugin format | ||
| 19 | |||
| 20 | =head1 VERSION | ||
| 21 | |||
| 22 | Version 0.03 | ||
| 23 | |||
| 24 | =head1 USAGE | ||
| 25 | |||
| 26 | ./build-properties-JS-file.pl --help | ||
| 27 | |||
| 28 | ./build-properties-JS-file.pl --i18n=path/to/my/file.xls --output=/tmp/js | ||
| 29 | |||
| 30 | =head1 REQUIRED ARGUMENTS | ||
| 31 | |||
| 32 | =over 2 | ||
| 33 | |||
| 34 | =item --i18n=path/to/my/file.xls | ||
| 35 | |||
| 36 | The excel file with all the language label -> traduction | ||
| 37 | |||
| 38 | =item --output=/tmp/js | ||
| 39 | |||
| 40 | The destination folder | ||
| 41 | |||
| 42 | =back | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | our $VERSION = '0.03'; | ||
| 47 | |||
| 48 | my ( $help, $i18n, $output ); | ||
| 49 | |||
| 50 | GetOptions( | ||
| 51 | 'i18n=s' => \$i18n, | ||
| 52 | 'output=s' => \$output, | ||
| 53 | 'help' => \$help, | ||
| 54 | ) || pod2usage(2); | ||
| 55 | |||
| 56 | if ( $help || !$i18n || !$output ) { | ||
| 57 | pod2usage(1); | ||
| 58 | exit 0; | ||
| 59 | } | ||
| 60 | |||
| 61 | my $parser = HON::I18N::Converter->new( excel => $i18n ); | ||
| 62 | |||
| 63 | my $header = <<"EOS"; | ||
| 64 | // Automatically generated by the HON-I18N-Converter project | ||
| 65 | // Please do not modify this file directly!! | ||
| 66 | |||
| 67 | EOS | ||
| 68 | |||
| 69 | $parser->build_properties_file( 'JS', $output, $header ); | ||
| 70 | |||
| 71 | =head1 AUTHOR | ||
| 72 | |||
| 73 | Samia Chahlal, C<< <samia.chahlal at yahoo.com> >> | ||
| 74 | |||
| 75 | =head1 BUGS AND LIMITATIONS | ||
| 76 | |||
| 77 | Please report any bugs or feature requests to C<bug-hon-i18n-converter at rt.cpan.org>, or through | ||
| 78 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HON-I18N-Converter>. I will be notified, and then you'll | ||
| 79 | automatically be notified of progress on your bug as I make changes. | ||
| 80 | |||
| 81 | =head1 SUPPORT | ||
| 82 | |||
| 83 | You can find documentation for this module with the perldoc command. | ||
| 84 | |||
| 85 | perldoc HON::I18N::Converter | ||
| 86 | |||
| 87 | |||
| 88 | You can also look for information at: | ||
| 89 | |||
| 90 | =over 4 | ||
| 91 | |||
| 92 | =item * RT: CPAN's request tracker (report bugs here) | ||
| 93 | |||
| 94 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=HON-I18N-Converter> | ||
| 95 | |||
| 96 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 97 | |||
| 98 | L<http://annocpan.org/dist/HON-I18N-Converter> | ||
| 99 | |||
| 100 | =item * CPAN Ratings | ||
| 101 | |||
| 102 | L<http://cpanratings.perl.org/d/HON-I18N-Converter> | ||
| 103 | |||
| 104 | =item * Search CPAN | ||
| 105 | |||
| 106 | L<http://search.cpan.org/dist/HON-I18N-Converter/> | ||
| 107 | |||
| 108 | =back | ||
| 109 | |||
| 110 | |||
| 111 | =head1 ACKNOWLEDGEMENTS | ||
| 112 | |||
| 113 | |||
| 114 | =head1 LICENSE AND COPYRIGHT | ||
| 115 | |||
| 116 | Copyright 2013 Samia Chahlal. | ||
| 117 | |||
| 118 | This program is free software; you can redistribute it and/or modify it | ||
| 119 | under the terms of either: the GNU General Public License as published | ||
| 120 | by the Free Software Foundation; or the Artistic License. | ||
| 121 | |||
| 122 | See http://dev.perl.org/licenses/ for more information. | ||
| 123 | |||
| 124 | =cut |