This repository has been archived by the owner. It is now read-only.

kemalyst-i18n

I18n library integration

kemalyst-i18n

I18n integration to kemalyst framework

Installation

Add this to your application's shard.yml:

dependencies:
  kemalyst-i18n:
    github: TechMagister/kemalyst-i18n

Usage

Create a file : config/i18n.cr

require "kemalyst-i18n"

Kemalyst::I18n.config do |config|
	# Backend default to I18n::Backend::Yaml
	# config.backend = I18n::Backend::Yaml.new
	
	# Default locale ( default to "en" )
	# config.default_locale = "en"
	
	# Separator between sub levels of data (default to '.')
	# ex : I18n.translate("some#thing") instead of "some.thing" 
	# config.default_separator = '.'
	
	# Returns the current exception handler. Defaults to an instance of
    # I18n::ExceptionHandler.
    # config.exception_handler = ExceptionHandler.new
	
	# The path from where the translations should be loaded
	config.load_path += ["./locales"]
end

# !! don't forget to init !!
I18n.init

Add the handler to the list into config/application.cr

Kemalyst::Application.config do |config|
	...
	# place it BEFORE the router
	handlers = [
		...
		Kemalyst::I18n::Handler.instance,
		Kemalyst::Handler::Router.instance
	]
	...
end

Contributing

  1. Fork it ( https://github.com/TechMagister/kemalyst-i18n/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

kemalyst-i18n

Owner
Statistic
  • 2
  • 0
  • 0
  • 0
  • 0
  • almost 8 years ago
  • December 15, 2016
License

MIT License

Links
Synced at

Thu, 07 Nov 2024 01:38:41 GMT

Languages