lita-google-translate 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.coveralls.yml +1 -0
 - data/.gitignore +18 -0
 - data/.travis.yml +8 -0
 - data/Gemfile +3 -0
 - data/LICENSE +19 -0
 - data/README.md +130 -0
 - data/Rakefile +6 -0
 - data/lib/lita-google-translate.rb +12 -0
 - data/lib/lita/handlers/google_translate.rb +102 -0
 - data/lita-google-translate.gemspec +27 -0
 - data/locales/en.yml +13 -0
 - data/spec/lita/handlers/google_translate_spec.rb +137 -0
 - data/spec/spec_helper.rb +14 -0
 - data/templates/.gitkeep +0 -0
 - metadata +189 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 567a014c803d00fd5a603583857f1dabf2b1b653
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: d33263924120684d39abc087d0db637bfd9852bb
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 87e1538498018ea39114124b7d6213247a1d04c1c76c855b61d644ac9ea28b7707f9b71779e58e483ce7655d3156c94e019d55d7927185603395885b6664d646
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 48cb21369098c30e77e036b3511e3f59dadd6393bbc08a4ce3dda311548f1bc4f277115c36283dd970df3d05646c9a91b1b1e1f33be0b0eaa519083bce0f5d28
         
     | 
    
        data/.coveralls.yml
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            service_name: travis-ci
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2015 Tristan Chong
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 4 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 5 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 6 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 7 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 8 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 11 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 14 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 15 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 16 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 17 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 18 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 19 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,130 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # lita-google-translate
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://travis-ci.org/tristaneuan/lita-google-translate)
         
     | 
| 
      
 4 
     | 
    
         
            +
            [](https://coveralls.io/r/tristaneuan/lita-google-translate)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            **lita-google-translate** is a handler for [Lita](https://github.com/jimmycuadra/lita) that performs translation and live interpretation with Google Translate.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Add lita-google-translate to your Lita instance's Gemfile:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ``` ruby
         
     | 
| 
      
 13 
     | 
    
         
            +
            gem "lita-google-translate"
         
     | 
| 
      
 14 
     | 
    
         
            +
            ```
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ## Configuration
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            In order to use this plugin, you must obtain a [Google Translate API key](https://cloud.google.com/translate/v2/pricing).
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ``` ruby
         
     | 
| 
      
 21 
     | 
    
         
            +
            Lita.configure do |config|
         
     | 
| 
      
 22 
     | 
    
         
            +
              config.handlers.google_translate.api_key = "YOUR API KEY GOES HERE"
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
      
 24 
     | 
    
         
            +
            ```
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ### Optional attributes
         
     | 
| 
      
 27 
     | 
    
         
            +
            * `default_language` (String) - The code corresponding to the desired target language for translation and interpretation when none is explicitly given. Default: `en`
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            ``` ruby
         
     | 
| 
      
 30 
     | 
    
         
            +
            Lita.configure do |config|
         
     | 
| 
      
 31 
     | 
    
         
            +
              config.handlers.google_translate.default_language = "ja"
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
      
 33 
     | 
    
         
            +
            ```
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            Using the `translate` (or `t`) command will translate a given phrase. Source and/or target languages may be optionally specified using the syntax `translate(FROM:TO)`
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ```
         
     | 
| 
      
 40 
     | 
    
         
            +
            <me>   lita: translate hola
         
     | 
| 
      
 41 
     | 
    
         
            +
            <lita> Hello
         
     | 
| 
      
 42 
     | 
    
         
            +
            <me>   lita: t(es) hello
         
     | 
| 
      
 43 
     | 
    
         
            +
            <lita> Hola
         
     | 
| 
      
 44 
     | 
    
         
            +
            <me>   lita: translate(zh-cn:fr) 你好
         
     | 
| 
      
 45 
     | 
    
         
            +
            <lita> Bonjour
         
     | 
| 
      
 46 
     | 
    
         
            +
            <me>   lita: translate(zh-cn:) 你好
         
     | 
| 
      
 47 
     | 
    
         
            +
            <lita> Hello
         
     | 
| 
      
 48 
     | 
    
         
            +
            <me>   lita: translate(:es) hello
         
     | 
| 
      
 49 
     | 
    
         
            +
            <lita> Hola
         
     | 
| 
      
 50 
     | 
    
         
            +
            ```
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            Using the `interpret` command will interpret your messages on the fly until you type `!interpret`. Again, source and/or target languages may be optionally specified using the syntax `interpret(FROM:TO)`
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            ```
         
     | 
| 
      
 55 
     | 
    
         
            +
            <me>   lita: interpret(fr)
         
     | 
| 
      
 56 
     | 
    
         
            +
            <me>   i don't want to talk to you anymore, you empty-headed animal food trough wiper
         
     | 
| 
      
 57 
     | 
    
         
            +
            <lita> je ne veux plus parler de vous, vous animaux tête vide mangeoire glace
         
     | 
| 
      
 58 
     | 
    
         
            +
            <me>   i fart in your general direction!
         
     | 
| 
      
 59 
     | 
    
         
            +
            <lita> Je pète dans votre direction générale!
         
     | 
| 
      
 60 
     | 
    
         
            +
            <me>   your mother was a hamster and your father smelled of elderberries
         
     | 
| 
      
 61 
     | 
    
         
            +
            <lita> votre mère était un hamster et votre père avait une odeur de baies de sureau
         
     | 
| 
      
 62 
     | 
    
         
            +
            <me>   !interpret
         
     | 
| 
      
 63 
     | 
    
         
            +
            ```
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            ## Supported languages
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            This list can be accessed within your chat client by sending Lita the command: `languages`
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            Language | Code
         
     | 
| 
      
 70 
     | 
    
         
            +
            --- | ---
         
     | 
| 
      
 71 
     | 
    
         
            +
            Afrikaans | `af`
         
     | 
| 
      
 72 
     | 
    
         
            +
            Albanian | `sq`
         
     | 
| 
      
 73 
     | 
    
         
            +
            Arabic | `ar`
         
     | 
| 
      
 74 
     | 
    
         
            +
            Belarusian | `be`
         
     | 
| 
      
 75 
     | 
    
         
            +
            Bulgarian | `bg`
         
     | 
| 
      
 76 
     | 
    
         
            +
            Catalan | `ca`
         
     | 
| 
      
 77 
     | 
    
         
            +
            Simplified Chinese | `zh-CN`
         
     | 
| 
      
 78 
     | 
    
         
            +
            Traditional Chinese | `zh-TW`
         
     | 
| 
      
 79 
     | 
    
         
            +
            Croatian | `hr`
         
     | 
| 
      
 80 
     | 
    
         
            +
            Czech | `cs`
         
     | 
| 
      
 81 
     | 
    
         
            +
            Danish | `da`
         
     | 
| 
      
 82 
     | 
    
         
            +
            Dutch | `nl`
         
     | 
| 
      
 83 
     | 
    
         
            +
            English | `en`
         
     | 
| 
      
 84 
     | 
    
         
            +
            Estonian | `et`
         
     | 
| 
      
 85 
     | 
    
         
            +
            Filipino (Tagalog) | `tl`
         
     | 
| 
      
 86 
     | 
    
         
            +
            Finnish | `fi`
         
     | 
| 
      
 87 
     | 
    
         
            +
            French | `fr`
         
     | 
| 
      
 88 
     | 
    
         
            +
            Galician | `gl`
         
     | 
| 
      
 89 
     | 
    
         
            +
            German | `de`
         
     | 
| 
      
 90 
     | 
    
         
            +
            Greek | `el`
         
     | 
| 
      
 91 
     | 
    
         
            +
            Haitian Creole | `ht`
         
     | 
| 
      
 92 
     | 
    
         
            +
            Hebrew | `iw`
         
     | 
| 
      
 93 
     | 
    
         
            +
            Hindi | `hi`
         
     | 
| 
      
 94 
     | 
    
         
            +
            Hungarian | `hu`
         
     | 
| 
      
 95 
     | 
    
         
            +
            Icelandic | `is`
         
     | 
| 
      
 96 
     | 
    
         
            +
            Indonesian | `id`
         
     | 
| 
      
 97 
     | 
    
         
            +
            Irish | `ga`
         
     | 
| 
      
 98 
     | 
    
         
            +
            Italian | `it`
         
     | 
| 
      
 99 
     | 
    
         
            +
            Japanese | `ja`
         
     | 
| 
      
 100 
     | 
    
         
            +
            Latvian | `lv`
         
     | 
| 
      
 101 
     | 
    
         
            +
            Lithuanian | `lt`
         
     | 
| 
      
 102 
     | 
    
         
            +
            Macedonian | `mk`
         
     | 
| 
      
 103 
     | 
    
         
            +
            Malay | `ms`
         
     | 
| 
      
 104 
     | 
    
         
            +
            Maltese | `mt`
         
     | 
| 
      
 105 
     | 
    
         
            +
            Norwegian | `no`
         
     | 
| 
      
 106 
     | 
    
         
            +
            Persian | `fa`
         
     | 
| 
      
 107 
     | 
    
         
            +
            Polish | `pl`
         
     | 
| 
      
 108 
     | 
    
         
            +
            Portuguese | `pt`
         
     | 
| 
      
 109 
     | 
    
         
            +
            Romanian | `ro`
         
     | 
| 
      
 110 
     | 
    
         
            +
            Russian | `ru`
         
     | 
| 
      
 111 
     | 
    
         
            +
            Serbian | `sr`
         
     | 
| 
      
 112 
     | 
    
         
            +
            Slovak | `sk`
         
     | 
| 
      
 113 
     | 
    
         
            +
            Slovenian | `sl`
         
     | 
| 
      
 114 
     | 
    
         
            +
            Spanish | `es`
         
     | 
| 
      
 115 
     | 
    
         
            +
            Swahili | `sw`
         
     | 
| 
      
 116 
     | 
    
         
            +
            Swedish | `sv`
         
     | 
| 
      
 117 
     | 
    
         
            +
            Thai | `th`
         
     | 
| 
      
 118 
     | 
    
         
            +
            Turkish | `tr`
         
     | 
| 
      
 119 
     | 
    
         
            +
            Ukrainian | `uk`
         
     | 
| 
      
 120 
     | 
    
         
            +
            Vietnamese | `vi`
         
     | 
| 
      
 121 
     | 
    
         
            +
            Welsh | `cy`
         
     | 
| 
      
 122 
     | 
    
         
            +
            Yiddish | `yi`
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
            ## Credits
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
            lita-google-translate's live interpretation feature was inspired by and adapted from [lita-translation](https://github.com/chua-mbt/lita-translation).
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
            [MIT](http://opensource.org/licenses/MIT)
         
     | 
    
        data/Rakefile
    ADDED
    
    
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "lita"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Lita.load_locales Dir[File.expand_path(
         
     | 
| 
      
 4 
     | 
    
         
            +
              File.join("..", "..", "locales", "*.yml"), __FILE__
         
     | 
| 
      
 5 
     | 
    
         
            +
            )]
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require "lita/handlers/google_translate"
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Lita::Handlers::GoogleTranslate.template_root File.expand_path(
         
     | 
| 
      
 10 
     | 
    
         
            +
              File.join("..", "..", "templates"),
         
     | 
| 
      
 11 
     | 
    
         
            +
             __FILE__
         
     | 
| 
      
 12 
     | 
    
         
            +
            )
         
     | 
| 
         @@ -0,0 +1,102 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "to_lang"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Lita
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Handlers
         
     | 
| 
      
 5 
     | 
    
         
            +
                class GoogleTranslate < Handler
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  config :api_key, type: String, required: true
         
     | 
| 
      
 8 
     | 
    
         
            +
                  config :default_language, type: String, default: "en"
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  route(
         
     | 
| 
      
 11 
     | 
    
         
            +
                    /^t(?:ranslate)?(?:[\[\(](?:(?<from>[\-[[:alpha:]]]*)[\:\>,]\s*)?(?<to>[\-[[:alpha:]]]*)[\]\)])?\s+(?<text>.+)/i,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    :translate, command: true, help: {
         
     | 
| 
      
 13 
     | 
    
         
            +
                      t("help.translate_key") => t("help.translate_value"),
         
     | 
| 
      
 14 
     | 
    
         
            +
                      t("help.translate_params_key") => t("help.translate_params_value")
         
     | 
| 
      
 15 
     | 
    
         
            +
                    }
         
     | 
| 
      
 16 
     | 
    
         
            +
                  )
         
     | 
| 
      
 17 
     | 
    
         
            +
                  route(
         
     | 
| 
      
 18 
     | 
    
         
            +
                    /^interpret(?:[\[\(](?:(?<from>[\-[[:alpha:]]]*)[\:\>,]\s*)?(?<to>[\-[[:alpha:]]]*)[\]\)])?(?:\s+(?<text>.+))?/i,
         
     | 
| 
      
 19 
     | 
    
         
            +
                    :interpret_start, command: true,
         
     | 
| 
      
 20 
     | 
    
         
            +
                    help: {t("help.interpret_key") => t("help.interpret_value")}
         
     | 
| 
      
 21 
     | 
    
         
            +
                  )
         
     | 
| 
      
 22 
     | 
    
         
            +
                  route(/./, :interpret_monitor, command: false)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  route(/!interpret/i, :interpret_stop, command: false)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  route(
         
     | 
| 
      
 25 
     | 
    
         
            +
                    /^languages/i, :languages, command: true,
         
     | 
| 
      
 26 
     | 
    
         
            +
                    help: {t("help.languages_key") => t("help.languages_value")}
         
     | 
| 
      
 27 
     | 
    
         
            +
                  )
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  def initialize(robot)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    super
         
     | 
| 
      
 31 
     | 
    
         
            +
                    @@codes = ToLang::CODEMAP.each_value.map {|v| v.downcase}.to_set
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  def translate(response)
         
     | 
| 
      
 35 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 36 
     | 
    
         
            +
                      response.reply get_translation(*parse_command(response.match_data))
         
     | 
| 
      
 37 
     | 
    
         
            +
                    rescue InvalidLanguage => e
         
     | 
| 
      
 38 
     | 
    
         
            +
                      response.reply format_error(e.message)
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  def interpret_start(response)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 44 
     | 
    
         
            +
                      from, to, text = parse_command(response.match_data)
         
     | 
| 
      
 45 
     | 
    
         
            +
                      redis.set("#{response.user.id}:from", from)
         
     | 
| 
      
 46 
     | 
    
         
            +
                      redis.set("#{response.user.id}:to", to)
         
     | 
| 
      
 47 
     | 
    
         
            +
                      response.reply get_translation(from, to, text) unless text.nil?
         
     | 
| 
      
 48 
     | 
    
         
            +
                    rescue InvalidLanguage => e
         
     | 
| 
      
 49 
     | 
    
         
            +
                      response.reply format_error(e.message)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    end
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                  def interpret_monitor(response)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    return if response.message.body.include?("!interpret")
         
     | 
| 
      
 55 
     | 
    
         
            +
                    to = redis.get("#{response.user.id}:to")
         
     | 
| 
      
 56 
     | 
    
         
            +
                    unless to.nil? || response.message.command?
         
     | 
| 
      
 57 
     | 
    
         
            +
                      from = redis.get("#{response.user.id}:from")
         
     | 
| 
      
 58 
     | 
    
         
            +
                      response.reply get_translation(from, to, response.message.body)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    end
         
     | 
| 
      
 60 
     | 
    
         
            +
                  end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                  def interpret_stop(response)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    redis.del("#{response.user.id}:to")
         
     | 
| 
      
 64 
     | 
    
         
            +
                    redis.del("#{response.user.id}:from")
         
     | 
| 
      
 65 
     | 
    
         
            +
                  end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                  def languages(response)
         
     | 
| 
      
 68 
     | 
    
         
            +
                    response.reply_privately ToLang::CODEMAP.each.map {|k,v| "#{k}: #{v}"}.join("\n")
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  private
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                  def parse_command(md)
         
     | 
| 
      
 74 
     | 
    
         
            +
                    from = falsy(md[:from]) ? nil : md[:from]
         
     | 
| 
      
 75 
     | 
    
         
            +
                    raise InvalidLanguage, from unless from.nil? || @@codes.include?(from.downcase)
         
     | 
| 
      
 76 
     | 
    
         
            +
                    to = falsy(md[:to]) ? config.default_language : md[:to]
         
     | 
| 
      
 77 
     | 
    
         
            +
                    raise InvalidLanguage, to unless @@codes.include?(to.downcase)
         
     | 
| 
      
 78 
     | 
    
         
            +
                    text = md[:text]
         
     | 
| 
      
 79 
     | 
    
         
            +
                    [from, to, text]
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                  def get_translation(from, to, text)
         
     | 
| 
      
 83 
     | 
    
         
            +
                    ToLang.start(config.api_key)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    falsy(from) ? text.translate(to) : text.translate(to, :from => from)
         
     | 
| 
      
 85 
     | 
    
         
            +
                  end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                  def format_error(code)
         
     | 
| 
      
 88 
     | 
    
         
            +
                    "'#{code}' is not a valid language code. For available languages, send me the command: languages"
         
     | 
| 
      
 89 
     | 
    
         
            +
                  end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                  def falsy(code)
         
     | 
| 
      
 92 
     | 
    
         
            +
                    code.nil? || code.empty?
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                class InvalidLanguage < Exception
         
     | 
| 
      
 98 
     | 
    
         
            +
                end
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
                Lita.register_handler(GoogleTranslate)
         
     | 
| 
      
 101 
     | 
    
         
            +
              end
         
     | 
| 
      
 102 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 2 
     | 
    
         
            +
              spec.name          = "lita-google-translate"
         
     | 
| 
      
 3 
     | 
    
         
            +
              spec.version       = "0.1.0"
         
     | 
| 
      
 4 
     | 
    
         
            +
              spec.authors       = ["Tristan Chong"]
         
     | 
| 
      
 5 
     | 
    
         
            +
              spec.email         = ["ong@tristaneuan.ch"]
         
     | 
| 
      
 6 
     | 
    
         
            +
              spec.description   = "A Lita handler that performs translation and live interpretation with Google Translate."
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.summary       = "A Lita handler that performs translation and live interpretation with Google Translate."
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.homepage      = "https://github.com/tristaneuan/lita-google-translate"
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.metadata      = { "lita_plugin_type" => "handler" }
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              spec.files         = `git ls-files`.split($/)
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 15 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              spec.add_runtime_dependency "lita", ">= 4.4"
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.add_runtime_dependency "to_lang", "1.0.0"
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.3"
         
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_development_dependency "pry-byebug"
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency "rake"
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency "rack-test"
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency "rspec", ">= 3.0.0"
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency "simplecov"
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_development_dependency "coveralls"
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
    
        data/locales/en.yml
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            en:
         
     | 
| 
      
 2 
     | 
    
         
            +
              lita:
         
     | 
| 
      
 3 
     | 
    
         
            +
                handlers:
         
     | 
| 
      
 4 
     | 
    
         
            +
                  google_translate:
         
     | 
| 
      
 5 
     | 
    
         
            +
                    help:
         
     | 
| 
      
 6 
     | 
    
         
            +
                      translate_key: "translate TEXT"
         
     | 
| 
      
 7 
     | 
    
         
            +
                      translate_value: "Translates TEXT to the default language."
         
     | 
| 
      
 8 
     | 
    
         
            +
                      translate_params_key: "translate(FROM:TO) TEXT"
         
     | 
| 
      
 9 
     | 
    
         
            +
                      translate_params_value: "Translates TEXT from FROM to TO. (FROM and TO are optional language codes)"
         
     | 
| 
      
 10 
     | 
    
         
            +
                      interpret_key: "interpret(FROM:TO) [TEXT]"
         
     | 
| 
      
 11 
     | 
    
         
            +
                      interpret_value: "Interprets your messages on the fly until you type !interpret. (FROM and TO are optional language codes)"
         
     | 
| 
      
 12 
     | 
    
         
            +
                      languages_key: "languages"
         
     | 
| 
      
 13 
     | 
    
         
            +
                      languages_value: "Sends a list of language codes supported by lita-google-translate."
         
     | 
| 
         @@ -0,0 +1,137 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "spec_helper"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Lita::Handlers::GoogleTranslate, lita_handler: true do
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              before do
         
     | 
| 
      
 6 
     | 
    
         
            +
                registry.config.handlers.google_translate.api_key = ENV["GOOGLE_TRANSLATE_API_KEY"]
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              it { is_expected.to route_command("translate hola").to(:translate) }
         
     | 
| 
      
 10 
     | 
    
         
            +
              it { is_expected.to route_command("translate(en) hola").to(:translate) }
         
     | 
| 
      
 11 
     | 
    
         
            +
              it { is_expected.to route_command("translate(es:en) hola").to(:translate) }
         
     | 
| 
      
 12 
     | 
    
         
            +
              it { is_expected.to route_command("translate(es:) hola").to(:translate) }
         
     | 
| 
      
 13 
     | 
    
         
            +
              it { is_expected.to route_command("translate[en] hola").to(:translate) }
         
     | 
| 
      
 14 
     | 
    
         
            +
              it { is_expected.to route_command("translate(es, en) hola").to(:translate) }
         
     | 
| 
      
 15 
     | 
    
         
            +
              it { is_expected.to route_command("translate(es>en) hola").to(:translate) }
         
     | 
| 
      
 16 
     | 
    
         
            +
              it { is_expected.to route_command("t() hola").to(:translate) }
         
     | 
| 
      
 17 
     | 
    
         
            +
              it { is_expected.to route_command("interpret(es:en)").to(:interpret_start) }
         
     | 
| 
      
 18 
     | 
    
         
            +
              it { is_expected.to route_command("interpret(es:en) hola").to(:interpret_start) }
         
     | 
| 
      
 19 
     | 
    
         
            +
              it { is_expected.to route("hola").to(:interpret_monitor) }
         
     | 
| 
      
 20 
     | 
    
         
            +
              it { is_expected.to route("!interpret").to(:interpret_stop) }
         
     | 
| 
      
 21 
     | 
    
         
            +
              it { is_expected.to route_command("languages").to(:languages) }
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              context "with the default config" do
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                describe "#translate" do
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  it "translates with no parameters" do
         
     | 
| 
      
 28 
     | 
    
         
            +
                    send_command "translate hola"
         
     | 
| 
      
 29 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 30 
     | 
    
         
            +
                    expect(replies.first).to match /^hello$/i
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  it "translates with TO parameter" do
         
     | 
| 
      
 34 
     | 
    
         
            +
                    send_command "translate(EL) hello"
         
     | 
| 
      
 35 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 36 
     | 
    
         
            +
                    expect(replies.first).to match "Γεια σας"
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  it "translates with TO and FROM parameters" do
         
     | 
| 
      
 40 
     | 
    
         
            +
                    send_command "translate(zh-cn:de) 你好"
         
     | 
| 
      
 41 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 42 
     | 
    
         
            +
                    expect(replies.first).to match /^hallo$/i
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  it "translates with FROM parameter" do
         
     | 
| 
      
 46 
     | 
    
         
            +
                    send_command "translate(el:) Γεια σας"
         
     | 
| 
      
 47 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 48 
     | 
    
         
            +
                    expect(replies.first).to match /^hello$/i
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                  it "responds with an error message when an invalid source language is given" do
         
     | 
| 
      
 52 
     | 
    
         
            +
                    send_command "translate(asdf:en) hej"
         
     | 
| 
      
 53 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 54 
     | 
    
         
            +
                    expect(replies.first).to match /^'asdf' is not a valid language code\. For available languages, send me the command: languages$/
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  it "responds with an error message when an invalid target language is given" do
         
     | 
| 
      
 58 
     | 
    
         
            +
                    send_command "translate(es:hjkl) hola"
         
     | 
| 
      
 59 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 60 
     | 
    
         
            +
                    expect(replies.first).to match /^'hjkl' is not a valid language code\. For available languages, send me the command: languages$/
         
     | 
| 
      
 61 
     | 
    
         
            +
                  end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                describe "#interpret" do
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 68 
     | 
    
         
            +
                    send_command "interpret"
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  it "interprets with no parameters" do
         
     | 
| 
      
 72 
     | 
    
         
            +
                    send_message "hola"
         
     | 
| 
      
 73 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 74 
     | 
    
         
            +
                    expect(replies.first).to match /^hello$/i
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                  it "responds with an error message when an invalid language is given" do
         
     | 
| 
      
 78 
     | 
    
         
            +
                    send_command "interpret(asdf)"
         
     | 
| 
      
 79 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 80 
     | 
    
         
            +
                    expect(replies.first).to match /^'asdf' is not a valid language code\. For available languages, send me the command: languages$/
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                  after(:each) do
         
     | 
| 
      
 84 
     | 
    
         
            +
                    send_message "!interpret"
         
     | 
| 
      
 85 
     | 
    
         
            +
                  end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
              end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
              context "with a user-configured default language" do
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 94 
     | 
    
         
            +
                  registry.config.handlers.google_translate.default_language = "es"
         
     | 
| 
      
 95 
     | 
    
         
            +
                end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                describe "#translate" do
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                  it "translates with no parameters" do
         
     | 
| 
      
 100 
     | 
    
         
            +
                    send_command "translate hello"
         
     | 
| 
      
 101 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 102 
     | 
    
         
            +
                    expect(replies.first).to match /^hola$/i
         
     | 
| 
      
 103 
     | 
    
         
            +
                  end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                describe "#interpret" do
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 110 
     | 
    
         
            +
                    send_command "interpret"
         
     | 
| 
      
 111 
     | 
    
         
            +
                  end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                  it "interprets with no parameters" do
         
     | 
| 
      
 114 
     | 
    
         
            +
                    send_message "hello"
         
     | 
| 
      
 115 
     | 
    
         
            +
                    expect(replies.count).to eq 1
         
     | 
| 
      
 116 
     | 
    
         
            +
                    expect(replies.first).to match /^hola$/i
         
     | 
| 
      
 117 
     | 
    
         
            +
                  end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
                  after(:each) do
         
     | 
| 
      
 120 
     | 
    
         
            +
                    send_message "!interpret"
         
     | 
| 
      
 121 
     | 
    
         
            +
                  end
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
                end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
              end
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
              describe "#languages" do
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                it "responds with a list of languages and their codes" do
         
     | 
| 
      
 130 
     | 
    
         
            +
                  send_command "languages"
         
     | 
| 
      
 131 
     | 
    
         
            +
                  expect(replies.count).to eq 1
         
     | 
| 
      
 132 
     | 
    
         
            +
                  expect(replies.first).to match /^afrikaans: af\nalbanian: sq\n/
         
     | 
| 
      
 133 
     | 
    
         
            +
                end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
              end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "simplecov"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "coveralls"
         
     | 
| 
      
 3 
     | 
    
         
            +
            SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
         
     | 
| 
      
 4 
     | 
    
         
            +
              SimpleCov::Formatter::HTMLFormatter,
         
     | 
| 
      
 5 
     | 
    
         
            +
              Coveralls::SimpleCov::Formatter
         
     | 
| 
      
 6 
     | 
    
         
            +
            ]
         
     | 
| 
      
 7 
     | 
    
         
            +
            SimpleCov.start { add_filter "/spec/" }
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            require "lita-google-translate"
         
     | 
| 
      
 10 
     | 
    
         
            +
            require "lita/rspec"
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
         
     | 
| 
      
 13 
     | 
    
         
            +
            # was generated with Lita 4, the compatibility mode should be left disabled.
         
     | 
| 
      
 14 
     | 
    
         
            +
            Lita.version_3_compatibility_mode = false
         
     | 
    
        data/templates/.gitkeep
    ADDED
    
    | 
         
            File without changes
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,189 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: lita-google-translate
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Tristan Chong
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-06-18 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: lita
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '4.4'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '4.4'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: to_lang
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '1.3'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '1.3'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: pry-byebug
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: rack-test
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: 3.0.0
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: 3.0.0
         
     | 
| 
      
 111 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 112 
     | 
    
         
            +
              name: simplecov
         
     | 
| 
      
 113 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 117 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 118 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 119 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 121 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 122 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 124 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 125 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 126 
     | 
    
         
            +
              name: coveralls
         
     | 
| 
      
 127 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 128 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 129 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 130 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 131 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 132 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 133 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 134 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 135 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 136 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 137 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 138 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 139 
     | 
    
         
            +
            description: A Lita handler that performs translation and live interpretation with
         
     | 
| 
      
 140 
     | 
    
         
            +
              Google Translate.
         
     | 
| 
      
 141 
     | 
    
         
            +
            email:
         
     | 
| 
      
 142 
     | 
    
         
            +
            - ong@tristaneuan.ch
         
     | 
| 
      
 143 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 144 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 145 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 146 
     | 
    
         
            +
            files:
         
     | 
| 
      
 147 
     | 
    
         
            +
            - ".coveralls.yml"
         
     | 
| 
      
 148 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 149 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 150 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 151 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 152 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 153 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 154 
     | 
    
         
            +
            - lib/lita-google-translate.rb
         
     | 
| 
      
 155 
     | 
    
         
            +
            - lib/lita/handlers/google_translate.rb
         
     | 
| 
      
 156 
     | 
    
         
            +
            - lita-google-translate.gemspec
         
     | 
| 
      
 157 
     | 
    
         
            +
            - locales/en.yml
         
     | 
| 
      
 158 
     | 
    
         
            +
            - spec/lita/handlers/google_translate_spec.rb
         
     | 
| 
      
 159 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 160 
     | 
    
         
            +
            - templates/.gitkeep
         
     | 
| 
      
 161 
     | 
    
         
            +
            homepage: https://github.com/tristaneuan/lita-google-translate
         
     | 
| 
      
 162 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 163 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 164 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 165 
     | 
    
         
            +
              lita_plugin_type: handler
         
     | 
| 
      
 166 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 167 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 168 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 169 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 170 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 171 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 172 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 173 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 174 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 175 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 176 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 177 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 178 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 179 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 180 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 181 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 182 
     | 
    
         
            +
            rubygems_version: 2.4.5
         
     | 
| 
      
 183 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 184 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 185 
     | 
    
         
            +
            summary: A Lita handler that performs translation and live interpretation with Google
         
     | 
| 
      
 186 
     | 
    
         
            +
              Translate.
         
     | 
| 
      
 187 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 188 
     | 
    
         
            +
            - spec/lita/handlers/google_translate_spec.rb
         
     | 
| 
      
 189 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     |