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

test-component-package-ca

v0.0.3

Published

Downloads

6

Readme

How to use?

with HOC:

  import { withTranslation } from 'test-component-package-ca';

  const myTranslations = {
  schedule: "calendario",
  tags: "etiquetas",
  "log out": "cerrar sesion",
  "sign up": "crear cuenta",
  "log in": "loguearse",
  connected: "conectado",
  "share my activity": "compartir mi actividad",
  channel: "canal",
  security: "seguridad",
  friends: "amigos",
  subscriptions: "suscripciones",
  wallet: "cartera",
  configuration: "configuracion",
  language: "idioma",
  "dark theme": "tema oscuro",
};

  const TranslatorTest = ({
  text,
  t,
  setTranslations,
}: WithTranslateProps) => {
  useEffect(() => {
    setTranslations(myTranslations);
  }, []);

  return <div>{t(text)}</div>;
};

export default withTranslation(TranslatorTestTwo);

with Render Props:

  import { Translate } from 'test-component-package-ca';

  export const TranslatorTest = ({ text }: { text: string }) => {
  return (
    <Translate>
      {({ t, setTranslations }) => {
        setTranslations(myTranslations);
        return <p>{t(text)}</p>;
      }}
    </Translate>
  );
};

with Hooks: wrap the code with:

  import { TranslateProvider } from 'test-component-package-ca'
  <TranslateProvider>
   <Component />
  </TranslateProvider>

  const TranslatorTest = ({ text }: { text: string }) => {
  const { t, setTranslations } = useTranslate();

  React.useEffect(() => {
    setTranslations(myTranslations);
  }, []);

  return <div>{t(text)}</div>;
};

const TranslatorTestWithProvider = ({ text }: { text: string }) => {
  return (
    <TranslateProvider>
      <TranslatorTest text={text} />
    </TranslateProvider>
  );
};

and then you can use inside your component

import { useTranslate } from 'test-component-package-ca'
  const {t, addTranslations} = useTranslate();

or you can simply use the default component:

  import { TranslateText } from 'test-component-package-ca'

  <TranslateText translations={myTranslations} text="log out" />

Base translations

{
  "hello": "hola",
  "mom": "mama",
  "login": "login",
  "home": "casa",
  "start": "inicio",
  "follow": "seguir",
  "explore": "explorar",
  "subscribe": "suscribirse",
  "buy": "comprar",
  "next": "siguiente",
  "last": "ultimo",
  "back": "atras",
  "search": "buscar",
  "sell": "vender",
  "description": "descripcion",
  "about": "acerca",
  "live": "en vivo",
  "direct": "directo",
  "profile": "perfil",
  "messages": "mensajes",
  "send": "enviar",
  "more": "mas",
  "notifications": "notificaciones",
  "trending": "tendencia",
  "show": "mostrar",
  "see": "ver",
  "image": "imagen",
  "like": "me gusta",
  "comment": "comentar",
  "views": "vistas",
  "process": "proceso",
  "loading": "cargando",
  "question": "pregunta",
  "questions": "preguntas",
  "frequently": "frecuentemente",
  "ask": "preguntar",
  "asked": "preguntado",
  "after": "despues",
  "before": "antes",
  "dislike": "no me gusta",
  "arrives": "llega",
  "arrive": "llegar",
  "end": "fin",
  "better": "mejor",
  "worse": "peor",
  "return": "volver",
  "build": "construir",
  "enter": "entrar",
  "account": "cuenta",
  "dark": "oscuro",
  "light": "luz",
  "mode": "modo",
  "empty": "vaciar",
  "table": "tabla",
  "button": "boton",
  "element": "elemento",
  "my": "mi",
  "text": "texto",
  "translated": "traducido",
  "allow": "permitir",
}

or you can use the addTranslations function to add your own translations in the format shown above