Noosphere Possibilities Maximized
    Have ideas to improve npm?Join in the discussion! »

    hapi-basic-i18n-accept-language

    1.0.6 • Public • Published

    Build Status bitHound Overall Score bitHound Dependencies bitHound Dev Dependencies bitHound Code

    hapi-basic-i18n-accept-language

    • npm install hapi-basic-i18n-accept-language --save

    • npm install accept-language-parser --save

    • Plugin options w/ registration;

      server.register([
      {
          register: require("hapi-basic-i18n-accept-language"),
          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!"

    Install

    npm i hapi-basic-i18n-accept-language

    DownloadsWeekly Downloads

    1

    Version

    1.0.6

    License

    MIT

    Last publish

    Collaborators

    • avatar