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-12.2.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.1.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.5.beta.0 lib/react_on_rails/locales/to_js.rb
react_on_rails-12.0.4 lib/react_on_rails/locales/to_js.rb