Sha256: b21a71901dfac11008102a3091d55447e8cb6c29e4a9c4eedd6b24965ed1f3db

Contents?: true

Size: 674 Bytes

Versions: 10

Compression:

Stored size: 674 Bytes

Contents

# frozen_string_literal: true

require "erb"

module ReactOnRails
  module Locales
    class ToJs < Base
      def initialize
        super
      end

      private

      def file_format
        "js"
      end

      def template_translations
        <<-JS.strip_heredoc
          export const translations = #{@translations};
        JS
      end

      def template_default
        <<-JS.strip_heredoc
          import { defineMessages } from 'react-intl';

          const defaultLocale = \'#{default_locale}\';

          const defaultMessages = defineMessages(#{@defaults});

          export { defaultMessages, defaultLocale };
        JS
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
react_on_rails-12.0.3 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.3.beta.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.2 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.1 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.0.pre.beta.4 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.0.pre.beta.3 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.0.pre.beta.2 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.0.pre.beta.1 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.0.pre.beta.0 lib/react_on_rails/locales/to_js.rb