Document the new functionality
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 15 Oct 2016 16:40:16 +0000 (17:40 +0100)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 15 Oct 2016 16:48:09 +0000 (17:48 +0100)
lib/Lyrics/Fetcher/LyricsTranslate.pm

index 55f3761156ac294cdd89e0e32f763b20d6969eee..f1ee778cc3df6a57cd1303873138f1f75016ce3a 100644 (file)
@@ -401,28 +401,44 @@ Lyrics::Fetcher::LyricsTranslate - Get lyrics from lyricstranslate.com
   # This module should be used directly
   use Lyrics::Fetcher::LyricsTranslate;
   print Lyrics::Fetcher::LyricsTranslate->fetch('Lyube', 'Kombat');
   # This module should be used directly
   use Lyrics::Fetcher::LyricsTranslate;
   print Lyrics::Fetcher::LyricsTranslate->fetch('Lyube', 'Kombat');
+  # Equivalent to
+  print Lyrics::Fetcher::LyricsTranslate->fetch('Lyube', 'Kombat', 'English');
+  # Equivalent to
+  print Lyrics::Fetcher::LyricsTranslate->fetch('Lyube', 'Kombat', 328);
 
 
-  # Can also be used via Lyrics::Fetcher but produces ugly output
+
+  print $Lyrics::Fetcher::LyricsTranslate::LANGUAGES{English}; # prints 328
+
+
+  # Can also be used via Lyrics::Fetcher but produces ugly output and
+  # does not support a custom target language
   use Lyrics::Fetcher;
   print Lyrics::Fetcher->fetch('Lyube', 'Kombat', 'LyricsTranslate');
 
 =head1 DESCRIPTION
 
 This module tries to get translated lyrics from
   use Lyrics::Fetcher;
   print Lyrics::Fetcher->fetch('Lyube', 'Kombat', 'LyricsTranslate');
 
 =head1 DESCRIPTION
 
 This module tries to get translated lyrics from
-L<http://lyricstranslate.com>. It does a search for a translation of
-the given artist and song title from any language to English, and
-returns the contents of the first result found.
-
-This is a very basic implementation of the concept and it should be
-improved in future versions (for example supporting multiple
-destination languages).
+L<http://lyricstranslate.com>. It searches for a translation of the
+given artist and song title from any language to a requested language
+(which defaults to English), and returns the contents of the first
+result found.
 
 It is recommended to use the module directly, as using it via
 L<Lyrics::Fetcher> loses empty lines between parahraphs.
 
 
 It is recommended to use the module directly, as using it via
 L<Lyrics::Fetcher> loses empty lines between parahraphs.
 
+The target language can be specified as either a number or a string.
+If a string is given, it is looked up in the hash
+C<%Lyrics::Fetcher::LyricsTranslate::LANGUAGES> which maps language
+names to their numerical identifiers. The hash was generated from the
+website, and it might be outdated.
+
+The target language is passed as the third argument to the B<fetch>
+method. If using the module via L<Lyrics::Fetcher>, the target
+language cannot be set and defaults to English.
+
 =head1 SEE ALSO
 
 =head1 SEE ALSO
 
-L<Lyrics::Fetcher>
+L<Lyrics::Fetcher>, L<http://lyricstranslate.com>
 
 =head1 AUTHOR
 
 
 =head1 AUTHOR
 
This page took 0.011621 seconds and 4 git commands to generate.