Meikel Brandmeyer  committed b553cf0

Adjust README to new API

  • Participants
  • Parent commits 6622723
  • Branches default

Comments (0)

Files changed (1)

File README.markdown

 ## Basic Usage
-Define a resource bundle.
+Just call `resource` with qualified keyword to retrieve a key from the
+bundle specified by the namespace part of the keyword.
-    (j18n/defbundle my-bundle)
+    (resource ::my-message)
+    (resource ::aliased-namespace/my-message)
+    (resource :some.other.namespace/my-message)
-Or – providing an explicit package name –:
+The bundle name is derived from the namespace according to the usual
+namespace name to file name translation rules.
-    (j18n/defbundle my-bundle "optional.custom.package")
+Or you provide an explicit bundle:
-Then initialise the bundle in your application start up procedure.
-    (defn -main
-      [& args]
-      (j18n/init-bundles!)
-      …)
-Then use `translate` to translate your messages.
-    (translate :my.message)
-You may also use messages from another namespace's bundle:
-    (translate :some.other.namespace/other.message)
-You may assume the following properties file for the sake of the example.
-    my.message = meine Nachricht
+    (resource ::my-message (ResourceBundle/getBundle "custom.package"))
+    (resource :my-message  (ResourceBundle/getBundle "custom.package"))
+    (resource "my-message" (ResourceBundle/getBundle "custom.package"))
 ## Gradle, lein and other poison