Sha256: 023b94147aae02aac1f3fe23947b4c0d895218e1a675f6c302c545b8cb74141d

Contents?: true

Size: 628 Bytes

Versions: 24

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

require "erb"

module ReactOnRails
  module Locales
    class ToJs < Base
      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

24 entries across 24 versions & 1 rubygems

Version Path
react_on_rails-13.4.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.3.5 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.3.4 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.3.3 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.3.2 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.3.1 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.3.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.2.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.1.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.0.2 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.0.1 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.0.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-13.0.0.beta.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.6.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.5.2 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.5.1 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.5.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.4.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.4.0.rc.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.3.0 lib/react_on_rails/locales/to_js.rb