Class: LesliBabel::TranslationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/lesli_babel/translations_controller.rb

Instance Method Summary collapse

Instance Method Details

#deployObject



37
38
39
40
41
42
43
# File 'app/controllers/lesli_babel/translations_controller.rb', line 37

def deploy
    TranslationService.new(current_user, query).deploy

    respond_with_lesli(
        :turbo => stream_notification_success("Translation deployed successfully!")
    )
end

#downloadObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'app/controllers/lesli_babel/translations_controller.rb', line 57

def download

    engine = params[:engine]
    platform = params[:platform]

    translations_result = TranslationsMiddlemanService.build(engine) if platform == "middleman"
    translations_result = TranslationsAndroidService.build(engine) if platform == "android"
    translations_result = TranslationsFlutterService.build(engine) if platform == "flutter"
    translations_result = TranslationsIosService.build(engine) if platform == "ios"
    translations_result = TranslationsJsService.build() if platform == "js"

    return respond_with_error if translations_result.blank?

    zip_file = "#{platform}-#{engine}-translations.zip"

    LC::System::IO.zip(zip_file, translations_result.payload)

    redirect_to "/tmp/#{zip_file}"

end

#renovateObject



45
46
47
48
49
# File 'app/controllers/lesli_babel/translations_controller.rb', line 45

def renovate
    result = TranslationsSynchronizationService.remote_sync
    respond_with_successful if result.success?
    respond_with_error if not result.success?
end

#syncObject



51
52
53
54
55
# File 'app/controllers/lesli_babel/translations_controller.rb', line 51

def sync
    result = TranslationsSynchronizationService.remote_sync true
    respond_with_successful if result.success?
    respond_with_error if not result.success?
end