Skip to content

ubaltaci/hapi-basic-i18n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##hapi-basic-i18n

  • Plugin options w/ registration;

     server.register([
     {
         register: require("hapi-basic-i18n"),
         options: {
     		locale_path: "<absolutePath>",
     		cookie_name: "language",
     		default_language: "EN",
     		available_languages: ["EN"]
         }
     }], cb);
     
  • In view context:

     {{i18n "wtf"}}
  • In route handler:

     function(request, reply) {
     	reply(request.i18n("wtf"));
     }
  • Simply

     // en.js
     module.exports = {
     	"Hello": "Hello {0}!",
     };
     
     // in route handler
     console.log(request.i18n("Hello", "John"));
     
     // in view 
     {{i18n "Hello" "John"}}
     
     // Both outputs are "Hello John!"

About

hapi-basic-i18n

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published