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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@alrevele/translator

v19.2.6

Published

This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.

Readme

@alrevele/translator

Une librairie Angular pour gérer les traductions dynamiques de votre application avec support multi-langues.

Installation

npm install @alrevele/translator

Configuration Rapide

1. Importer le Module

Dans votre app.module.ts ou composant standalone :

import { AlreveleTranslatorModule } from '@alrevele/translator';

@NgModule({
  imports: [
    AlreveleTranslatorModule
  ]
})
export class AppModule { }

2. Initialiser les Traductions

Dans votre template principal (ex: app.component.html) :

<lib-alreveleTranslator 
  [language]="'fr'" 
  [software_key]="'votre-cle-logiciel'"
  [env]="'production'">
</lib-alreveleTranslator>

Utilisation

Méthode 1 : Avec le Composant

<lib-trl [key]="'HOME'"></lib-trl>
<lib-trl [key]="'WELCOME_MESSAGE'"></lib-trl>

Méthode 2 : Avec le Pipe (Recommandé)

<h1>{{ 'HOME' | trl }}</h1>
<p>{{ 'WELCOME_MESSAGE' | trl }}</p>
<button [title]="'TOOLTIP_TEXT' | trl">
  {{ 'BUTTON_LABEL' | trl }}
</button>

Paramètres

lib-alreveleTranslator

| Paramètre | Type | Requis | Défaut | Description | |-----------|------|--------|--------|-------------| | language | string | ✅ | - | Code de la langue (ex: 'fr', 'en') | | software_key | string | ✅ | - | Clé unique de votre logiciel | | env | 'local' \| 'production' | ❌ | 'production' | Environnement d'exécution |

Paramètre env

Le paramètre env contrôle le comportement d'affichage des traductions manquantes :

  • 'local' : Affiche le nom de la clé si la traduction n'existe pas (utile en développement)
  • 'production' : Affiche une chaîne vide si la traduction n'existe pas

Exemple en Développement

<lib-alreveleTranslator 
  [language]="'fr'" 
  [software_key]="'xxx'"
  [env]="'local'">
</lib-alreveleTranslator>

{{ 'CLE_INEXISTANTE' | trl }}
<!-- Affiche: CLE_INEXISTANTE -->

Exemple en Production

<lib-alreveleTranslator 
  [language]="'fr'" 
  [software_key]="'xxx'"
  [env]="'production'">
</lib-alreveleTranslator>

{{ 'CLE_INEXISTANTE' | trl }}
<!-- Affiche: (vide) -->

Changement de Langue Dynamique

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
    <lib-alreveleTranslator 
      [language]="currentLanguage" 
      [software_key]="softwareKey"
      [env]="'local'">
    </lib-alreveleTranslator>
    
    <select [(ngModel)]="currentLanguage">
      <option value="fr">Français</option>
      <option value="en">English</option>
      <option value="es">Español</option>
    </select>
    
    <h1>{{ 'WELCOME' | trl }}</h1>
  `
})
export class AppComponent {
  currentLanguage = 'fr';
  softwareKey = 'votre-cle-logiciel';
}

Les traductions se mettent à jour automatiquement lors du changement de langue.

Utilisation avec les Environnements Angular

// environment.ts (développement)
export const environment = {
  production: false,
  translationEnv: 'local' as const,
  softwareKey: 'dev-key'
};

// environment.prod.ts (production)
export const environment = {
  production: true,
  translationEnv: 'production' as const,
  softwareKey: 'prod-key'
};
<lib-alreveleTranslator 
  [language]="language" 
  [software_key]="environment.softwareKey"
  [env]="environment.translationEnv">
</lib-alreveleTranslator>

Import Standalone

Pour les composants standalone, vous pouvez importer directement le pipe :

import { TrlPipe } from '@alrevele/translator';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [TrlPipe],
  template: `
    <h1>{{ 'TITLE' | trl }}</h1>
    <p>{{ 'DESCRIPTION' | trl }}</p>
  `
})
export class ExampleComponent { }

Avantages du Pipe

Syntaxe concise : {{ 'KEY' | trl }} au lieu de <lib-trl [key]="'KEY'"></lib-trl>

Utilisable dans les attributs : [title]="'TOOLTIP' | trl"

Combinable avec d'autres pipes : {{ 'TEXT' | trl | uppercase }}

Réactif : Mise à jour automatique lors du changement de langue

API

AlreveleTranslatorService

Service injectable pour gérer les traductions :

import { AlreveleTranslatorService } from '@alrevele/translator';

constructor(private translatorService: AlreveleTranslatorService) {
  // Changer la langue
  this.translatorService.changeLanguage('en');
  
  // Changer l'environnement
  this.translatorService.setEnvironment('local');
  
  // S'abonner aux changements de langue
  this.translatorService.currentLanguage.subscribe(lang => {
    console.log('Langue actuelle:', lang);
  });
}

Build

ng build alrevele-translator

Publication

cd dist/alrevele-translator
npm publish

Support

Pour toute question ou problème, veuillez créer une issue sur le dépôt GitHub.

Licence

MIT


Version : 19.2.6
Angular : ^18.0.0