Skip to content

A powerful localisation library, because your code is not clutter.

License

Notifications You must be signed in to change notification settings

RTLBukkit/hazzard

 
 

Repository files navigation

Hazzard

A fork of http://www.github.com/Kyori/hazzard with comprehensible names.

i made this

GitHub branch checks state Codecov

Q: What do you say when you're gonna drunk dial someone?

A: hazzardMessages.alCoholYou()

A powerful localisation library to enforce DRY and simplify your code to the greatest extent allowed by your boss.

Hazzard is a localization library capable of creating proxy/mock classes, that implement an annotated interface.

Basic Usage

It can inflate the following interface into an instance capable of returning enriched localizations or sending the message using a registered service.

public interface MessageService {

	// Returns an enriched string for further composition, using "error.ticket_closed" as a lookup key that can define
    // a template, localization, resourcebundle property key, etc.
	@TranslationKey("error.ticket_closed")
	RichString exceptionTicketClosed();
	
	// Returns an enriched string for further composition, using the templateArgument sender.
    // e.g. say if RichString represented HTML, invoking it with exceptionInvalidSender("bob"); 
    // the returned literal could be a filled template of 
    // <span><strong>Error: </strong> invalid sender <pre>bob</pre></span>
	@TranslationKey("error.invalid_sender")
	RichString exceptionInvalidSender(@Placeholder String sender);

	
    // Sends the following viewer the message, with all placeholders substituted, via the registered messaging sending service.
	@TranslationKey("feedback.create")
	void feedbackCreate(Audience viewer, @Placeholder Ticket ticket);
}

About

A powerful localisation library, because your code is not clutter.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 97.0%
  • Kotlin 3.0%