diff --git a/Gemfile b/Gemfile index 14d5ea09a22eb53dc9827e6bb3845d64b7ad084a..798f0e79253667e6821f97115fbf9e79489160bb 100644 --- a/Gemfile +++ b/Gemfile @@ -48,7 +48,7 @@ gem "jquery-ui-rails", git: "https://github.com/jquery-ui-rails/jquery-ui-rails. gem "kamifusen"#, path: "../kamifusen" gem "kaminari" gem "leaflet-rails" -gem "libretranslate" +gem "libretranslate"#, path: "../libretranslate" gem "mini_magick" gem "octokit" gem "omniauth-rails_csrf_protection", "~> 1.0" diff --git a/app/controllers/admin/translation_controller.rb b/app/controllers/admin/translation_controller.rb index 84d24be7e9b6eb088261e71535eb266812eb81bb..3273f11adfee5b708f2a7fc05803f6c7d1edfb0a 100644 --- a/app/controllers/admin/translation_controller.rb +++ b/app/controllers/admin/translation_controller.rb @@ -1,9 +1,9 @@ class Admin::TranslationController < Admin::ApplicationController def translate @target = translation_params[:target] - # @response = LibreTranslate.translate text: translation_params[:text], - # from: translation_params[:from], - # to: translation_params[:to] + # @response = LibreTranslate.translate translation_params[:text], + # source: translation_params[:from], + # target: translation_params[:to] @response = { 'translatedText' => 'test' } diff --git a/config/initializers/libretranslate.rb b/config/initializers/libretranslate.rb new file mode 100644 index 0000000000000000000000000000000000000000..2f044986a9b47decc12ae88d05d77de101200763 --- /dev/null +++ b/config/initializers/libretranslate.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +LibreTranslate.configure do |config| + # Configure the base URL of your LibreTranslate provider. + config.base_url = ENV.fetch("LIBRETRANSLATE_BASE_URL", "https://libretranslate.com") + + # Configure the API key that will be used in requests. + config.api_key = ENV["LIBRETRANSLATE_API_KEY"] +end \ No newline at end of file