npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ilib-loctool-webos-json

v1.1.5

Published

json type of file handler plugin for webOS platform loctool

Downloads

1,940

Readme

ilib-loctool-webos-json

ilib-loctool-webos-json is a plugin for the loctool that allows it to read and localize JSON type of file.
e.g. appinfo.json, qcardinfo.json. This plugin is optimized for the webOS platform.

JSON FileType

schema

For JSON file type localization, the schema file is needed. The plugin contains a built-in version of the schema file for the appinfo.json file type. For other json file types such as qcardinfo.json, the plugin looks for the schema file in the same directory as the json file. Here's a example for schema file.

{
    "id": "QCardDescription",
    "type": "object",
    "properties": {
        "title": {
            "type": "string",
            "description": "The title of the application.",
            "localizable": true
        },
    }
}

configuration

The plugin will look for the jsonMap property within the settings of your project.json file. The following settings are used within the jsonMap property:

"settings": {
    "jsonMap": {
        "mappings": {
            "**/appinfo.json": {
                "template": "[dir]/[resourceDir]/[localeDir]/[filename]"
            },
            "**/qcardinfo.json": {
                "template": "[dir]/[resourceDir]/[localeDir]/[filename]"
           }
        }
    }
}
  • mappings: a mapping between file matchers and an object that gives info used to localize the files that match it. This allows different json files within the project to be processed with different schema. The matchers are a micromatch-style string, similar to the the includes and excludes section of a project.json file. The value of that mapping is an object that can contain the following property:
    • template: a path template to use to generate the path to the translated output files. The template replaces strings in square brackets with special values, and keeps any characters intact that are not in square brackets. The default template, if not specified is [dir]]/[resourceDir]/[localeDir]/[filename].
      Please check the all available templates. link.
      The plugin recognizes and replaces the following strings in template strings:
      • [dir] the original directory where the matched source file came from. This is given as a directory that is relative to the root of the project.
      • [resourceDir] the root of the resource directory.
      • [localeDir] the full locale where each portion of the locale is a directory in this order: [langage], [script], [region].
      • [filename] the file name of the matching file.

Sample

The simple sample is provided in the ilib-loctool-samples repository. Please check the webos-json sample to see how the JSON file type is localized.

License

Copyright (c) 2019-2024, JEDLSoft

This plugin is license under Apache2. See the LICENSE file for more details.

Release Notes

v1.1.5

  • Updated dependencies. (loctool: 2.24.0)
  • Converted all the unit tests from nodeunit to jest.

v1.1.4

  • Removed npm-shrinkwrap.json. It takes a bigger memory size than I expected on webOS. so I decided not to maintain the file here.
  • Updated to use ilib's Locale class for locale parsing.

v1.1.3

  • Added loctool package to peerDependencies in package.json as well.
  • Moved micromatch package to dependencies in package.json because these are actually used in codes.
  • Removed ilib package to dependencies in package.json because it is not used in codes.

v1.1.2

  • Updated dependencies. (loctool: 2.23.1)
  • Updated to be included npm-shrinkwrap.json in the published files.

v1.1.1

  • Updated to skip the pseudo localization process when the --nopseudo option is true. If not, it occurs an error when the pseudo locale is not defined on the project.

v1.1.0

  • Updated dependencies. (loctool: 2.22.0)
  • Supported the pseudo localization.
  • Added ability to disable pseudo-localization in plugin when a project's pseudo-localization is enabled.
       "settings": {
            "json": {
                "disablePseudo": true
            }
        }

v1.0.0

  • Implemented for webOS json file type (appinfo.json and qcardinfo.json) of localization.
    Most of the code is the same as the ilib-loctool-webos-appinfo-json plugin. This plugin, however, expands upon the other plugin to support many different types of json files as used in webOS.
    • The plugin contains a built-in version of the schema file for the appinfo.json file type.
    • For other json file types such as qcardinfo.json, the plugin looks for the schema file in the same directory as the json file.
      "settings": {
          "mappings": {
              "**/appinfo.json": {
                  "template": "[dir]/[resourceDir]/[localeDir]/[filename]"
              },
              "**/qcardinfo.json": {
                  "template": "[dir]/[resourceDir]/[localeDir]/[filename]"
             }
         }
      }