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

sc-localization

v1.0.4

Published

In-memory low bundle size, type support, file-base localization, for server-rendering and client-rendering js library/framework

Downloads

459

Readme

sc-localization

build NPM Typescript Dependencies Bundle size Bundle size

In-memory, low bundle size, file-base localization package for JavaScript framework/library. Supports types, and works for both server and client. This package provides core functionality that you need to add localization to your project, because of this, you can customize your app localization behavior as you desire. Supports both server and client localization.

Definitions

  • server localization: Refers to tools that rely on server/node to render pages.

  • client localization: Refers to tools that rely on browsers to render pages.

  • parts: Refers to 1st depth keys of translation object, also refers to the 1st depth keys of locale file if you using single file for locale (more info).

  • partition: Imagine you don't like to have a big file that holds all your translations, and wants to separate it into smaller files and put relative texts near each other like 'common', 'home', 'about', and..., from now those smaller parts called partition (you may have heard of this as, segment, scope, namespace, and..., but the functionality is more important than its name).

Features

  • Type support (check this).
  • No global wrapper around your entire app.
  • Low bundle size.
  • Read/Fetch translation files, thus translation files add zero bytes to the JavaScript final bundle size.
  • Zero dependency! (although server localization uses fs and path, but you already have these in node environment, therefore excluded from bundle size).
  • Customize the localization behavior as you desire (like, remove/keep default locale from url).
  • [server localization]: Loads all translation into memory, therefore getting translation texts in your component costs you 1(more info), also no effect on bundle size and no need to send all translation to client.
  • [server localization]: No need to use await keyword when accessing translation texts.
  • [server localization]: Able to remove [locale] folder as wrapper in your routes (if your framework need this routes like Next.js app directory).
  • [client localization]: Uses fetch to get translations, by setting enablePartition to true, translation files can be downloaded partition by partition as needed, less bytes to transfer therefore more performance in general! more info.

Limitation

This package only reads/fetches translations and gives them to you, for the rest of the functionality you are responsible for implementing it, this gives you a high level of customization but requires more time to implement also adding a feature, for example, if you want to calculate a value and put it into text translation you need to do it by yourself, although for this situation you can do it by reading this page, but this was just an example.

How It's Work?

It's depends on whether you want to use server or client localization, for more info Check this link

Supporting Type

If you using typescript, and your IDE supports intelliSense you can add your localization type, this helps you avoid mis-spelling words and easy access (less copy/paste) to nested translation when you press ., cool! hah?! (more info).

Documentation