New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dfx-translate

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dfx-translate - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

40

bundles/dfx-translate.umd.js

@@ -145,7 +145,27 @@ (function (global, factory) {

}
DfxTranslateModule.boot = function (configuration) {
return DfxTranslateModule.setup(configuration);
};
;
DfxTranslateModule.config = function (configuration) {
console.log('dfx-translate | DEPRECATED API USAGE; Please use DfxTranslateModule.setup(...)');
return DfxTranslateModule.setup(configuration);
};
;
DfxTranslateModule.setup = function (configuration) {
console.log(configuration);
return {
ngModule: DfxTranslateModule,
providers: [{ provide: TRANSLATE_CONFIG, useValue: configuration }]
providers: [
{
provide: TRANSLATE_CONFIG,
useValue: configuration
},
{
provide: i0.APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [TranslateService],
multi: true
},
]
};

@@ -157,10 +177,3 @@ };

DfxTranslateModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0__namespace, type: DfxTranslateModule, declarations: [TranslatePipe], exports: [TranslatePipe] });
DfxTranslateModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0__namespace, type: DfxTranslateModule, providers: [
{
provide: i0.APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [TranslateService],
multi: true
},
] });
DfxTranslateModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0__namespace, type: DfxTranslateModule, providers: [] });
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0__namespace, type: DfxTranslateModule, decorators: [{

@@ -171,10 +184,3 @@ type: i0.NgModule,

exports: [TranslatePipe],
providers: [
{
provide: i0.APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [TranslateService],
multi: true
},
]
providers: []
}]

@@ -181,0 +187,0 @@ }] });

@@ -7,7 +7,27 @@ import { APP_INITIALIZER, NgModule } from '@angular/core';

export class DfxTranslateModule {
static boot(configuration) {
return DfxTranslateModule.setup(configuration);
}
;
static config(configuration) {
console.log('dfx-translate | DEPRECATED API USAGE; Please use DfxTranslateModule.setup(...)');
return DfxTranslateModule.setup(configuration);
}
;
static setup(configuration) {
console.log(configuration);
return {
ngModule: DfxTranslateModule,
providers: [{ provide: TRANSLATE_CONFIG, useValue: configuration }]
providers: [
{
provide: TRANSLATE_CONFIG,
useValue: configuration
},
{
provide: APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [TranslateService],
multi: true
},
]
};

@@ -18,10 +38,3 @@ }

DfxTranslateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0, type: DfxTranslateModule, declarations: [TranslatePipe], exports: [TranslatePipe] });
DfxTranslateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0, type: DfxTranslateModule, providers: [
{
provide: APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [TranslateService],
multi: true
},
] });
DfxTranslateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0, type: DfxTranslateModule, providers: [] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0, type: DfxTranslateModule, decorators: [{

@@ -32,10 +45,3 @@ type: NgModule,

exports: [TranslatePipe],
providers: [
{
provide: APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [TranslateService],
multi: true
},
]
providers: []
}]

@@ -46,2 +52,2 @@ }] });

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGZ4LXRyYW5zbGF0ZS5tb2R1bGUuanMiLCJzb3VyY2VS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IFBsZWFzZSB1c2UgRGZ4VHJhbnNsYXRlTW9kdWxlLnNldHVwKC4uLiknKVxuICAgIHJldHVybiBEZnhUcmFuc2xhdGVNb2R1bGUuc2V0dXAoY29uZmlndXJhdGlvbik7XG4gIH07XG5cbiAgc3RhdGljIHNldHVwKGNvbmZpZ3VyYXRpb246IFRyYW5zbGF0ZUNvbmZpZyk6IE1vZHVsZVdpdGhQcm92aWRlcnM8RGZ4VHJhbnNsYXRlTW9kdWxlPiB7XG4gICAgY29uc29sZS5sb2coY29uZmlndXJhdGlvbik7XG4gICAgcmV0dXJuIHtcbiAgICAgIG5nTW9kdWxlOiBEZnhUcmFuc2xhdGVNb2R1bGUsXG4gICAgICBwcm92aWRlcnM6IFtcbiAgICAgICAge1xuICAgICAgICAgIHByb3ZpZGU6IFRSQU5TTEFURV9DT05GSUcsXG4gICAgICAgICAgdXNlVmFsdWU6IGNvbmZpZ3VyYXRpb25cbiAgICAgICAgfSxcbiAgICAgICAge1xuICAgICAgICAgIHByb3ZpZGU6IEFQUF9JTklUSUFMSVpFUixcbiAgICAgICAgICB1c2VGYWN0b3J5OiBzZXR1cFRyYW5zbGF0ZUZhY3RvcnksXG4gICAgICAgICAgZGVwczogW1RyYW5zbGF0ZVNlcnZpY2VdLFxuICAgICAgICAgIG11bHRpOiB0cnVlXG4gICAgICAgIH0sXG4gICAgICBdXG4gICAgfTtcbiAgfVxufVxuXG5leHBvcnQgZnVuY3Rpb24gc2V0dXBUcmFuc2xhdGVGYWN0b3J5KHNlcnZpY2U6IFRyYW5zbGF0ZVNlcnZpY2UpOiBGdW5jdGlvbiB7XG4gIHJldHVybiAoKSA9PiBzZXJ2aWNlLnVzZSgpO1xufVxuIl19
import { InjectionToken } from "@angular/core";
export const TRANSLATE_CONFIG = new InjectionToken('TRANSLATE_CONFIG');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRlLmNvbmZpZy5qcyIsInNvdXJjZVJvb3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bn0gZnJvbSBcIkBhbmd1bGFyL2NvcmVcIjtcblxuZXhwb3J0IGludGVyZmFjZSBUcmFuc2xhdGVDb25maWcge1xuICBkZWZhdWx0TGFuZ3VhZ2U/OiBzdHJpbmcgfCBudWxsO1xuICB1c2VMb2NhbFN0b3JhZ2U/OiBib29sZWFuIHwgbnVsbDtcbn1cblxuZXhwb3J0IGNvbnN0IFRSQU5TTEFURV9DT05GSUcgPSBuZXcgSW5qZWN0aW9uVG9rZW4oXG4gICdUUkFOU0xBVEVfQ09ORklHJ1xuKTtcbiJdfQ==

@@ -112,7 +112,27 @@ import * as i0 from '@angular/core';

class DfxTranslateModule {
static boot(configuration) {
return DfxTranslateModule.setup(configuration);
}
;
static config(configuration) {
console.log('dfx-translate | DEPRECATED API USAGE; Please use DfxTranslateModule.setup(...)');
return DfxTranslateModule.setup(configuration);
}
;
static setup(configuration) {
console.log(configuration);
return {
ngModule: DfxTranslateModule,
providers: [{ provide: TRANSLATE_CONFIG, useValue: configuration }]
providers: [
{
provide: TRANSLATE_CONFIG,
useValue: configuration
},
{
provide: APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [TranslateService],
multi: true
},
]
};

@@ -123,10 +143,3 @@ }

DfxTranslateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0, type: DfxTranslateModule, declarations: [TranslatePipe], exports: [TranslatePipe] });
DfxTranslateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0, type: DfxTranslateModule, providers: [
{
provide: APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [TranslateService],
multi: true
},
] });
DfxTranslateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0, type: DfxTranslateModule, providers: [] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.0", ngImport: i0, type: DfxTranslateModule, decorators: [{

@@ -137,10 +150,3 @@ type: NgModule,

exports: [TranslatePipe],
providers: [
{
provide: APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [TranslateService],
multi: true
},
]
providers: []
}]

@@ -147,0 +153,0 @@ }] });

@@ -7,3 +7,5 @@ import { ModuleWithProviders } from '@angular/core';

export declare class DfxTranslateModule {
static boot(configuration: TranslateConfig): ModuleWithProviders<DfxTranslateModule>;
static config(configuration: TranslateConfig): ModuleWithProviders<DfxTranslateModule>;
static setup(configuration: TranslateConfig): ModuleWithProviders<DfxTranslateModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<DfxTranslateModule, never>;

@@ -10,0 +12,0 @@ static ɵmod: i0.ɵɵNgModuleDeclaration<DfxTranslateModule, [typeof i1.TranslatePipe], never, [typeof i1.TranslatePipe]>;

import { InjectionToken } from "@angular/core";
export interface TranslateConfig {
defaultLanguage: string | null;
useLocalStorage: boolean | null;
defaultLanguage?: string | null;
useLocalStorage?: boolean | null;
}
export declare const TRANSLATE_CONFIG: InjectionToken<unknown>;
{
"name": "dfx-translate",
"version": "0.0.10",
"version": "0.0.11",
"private": false,

@@ -19,2 +19,4 @@ "license": "MIT",

"ng",
"ng-translate",
"ngx-translate",
"autotranslation",

@@ -25,3 +27,3 @@ "automation"

"bugs": {
"url": "https://gitlab.com/DatePoll/common/dfx-translate/issues"
"url": "https://gitlab.com/DatePoll/common/dfx-translate/-/issues"
},

@@ -28,0 +30,0 @@ "repository": {

# dfx-translate
A simple translation package for Angular 4 - 12.
A simple translate package for Angular 4 - 12.
### Features
* inline html translations with pipelines
* in-code translation with services
* an easy-to-use json structure
* auto-translation feature via https://github.com/LibreTranslate/LibreTranslate API integration
## Usage
## Setup
### Installation
```bash

@@ -14,9 +17,8 @@ npm install dfx-translate@latest

### Language file setup
Language files **must** be saved in `src/assets/i18n/LANGUAGE_CODE.json`; Create the directory if it does not exist.
```bash
mkdir -p ./src/assets/i18n
```
All of your language files are going to be stored in `src/assets/i18n/` folder. If there is no one in your project,
create one. Depending on which primary language you want to write your application you can pick from **"Supported
languages"**.
Lets say you've picked **english** as your primary language, create an `en.json` file with following content:
Choose a primary language, lets say you've picked **english**. Create an `en.json` file with following content:
```json

@@ -28,30 +30,23 @@ {

```
Note: The json structure must always consist of a key and value pair.
Now you want to translate `Welcome` into german. Create a `de.json` file with the content:
#### Manual translation
Choose an additional language, lets say you've picked **german**. Create an `de.json` file
```json
{
"WELCOME": "Willkommen"
"WELCOME": "Willkomen",
"WELCOME_SUBTEXT": "Fremder."
}
```
Note: You **do not** have to translate all strings if you are using the **auto-translate feature**.
#### Auto translate not translated strings
dfx-translate will take partially manual translated files into account, meaning it will only translate strings which
weren't translated. Sadly you will need a LibreTranlsate instance or access to one for this feature to work. More at **Auto deep
learning translation**
#### Auto translation
dfx-translate can translate the primary language into a whole new language and will take partially manual translated
languages into account, meaning it will only translate strings which are not occurring in the manual created files
located at `src/assets/i18n/LANGUAGE_CODE.json`.
Read more below;
### Registration in root (app) module
This has to be done only once in your project. Please keep following infromation in mind.
* The `defaultLanguage` property should be the same as your primary language.
* There should not be an auto generated language file for your default / primary language.
Use code values for the following properties from **"Supported languages"**
property | description | default value
--- | --- | ---
defaultLanguage | Short name of default language | `en`
useLocalStorage | Save selected languages as the preference into local storage | `true`
This has to be done only once in the project. Ideal in `app.module.ts`
```typescript

@@ -64,3 +59,3 @@ import {DfxTranslateModule} from "dfx-translate";

...
DfxTranslateModule.config({
DfxTranslateModule.setup({
configuration: {

@@ -72,3 +67,2 @@ defaultLanguage: 'de',

],
providers: [...],
bootstrap: [...]

@@ -79,7 +73,12 @@ })

```
property | description | default value
--- | --- | ---
defaultLanguage | Short code of the primary language (identically to the file name) | `en`
useLocalStorage | Saves selected languages as the preference into local storage | `true`
### Switch language
## Usage
### Switching languages
Language switching is as easy as one function call.
Language switching is as easy as one function call. Just pass a code from **"Supported languages"**
Note: The language code used has to exist as `src/assets/i18n/LANGUAGE_CODE.json`
```typescript

@@ -104,5 +103,3 @@ import {TranslateService} from "dfx-translate";

### Pipeline usage
If you want to use the tranlsation pipe you have to import the `DfxTranslateModule` into your used module
Import `DfxTranslateModule` into the module requiring the translation pipe.
```typescript

@@ -124,4 +121,3 @@ import {DfxTranslateModule} from "dfx-translate";

After that you can simple use the `tr` pipe in html
Now you can use it with `tr` in html
```angular2html

@@ -133,5 +129,3 @@ <h1>{{'WELCOME' | tr}}</h1>

### Service usage
It's also easily possible to access translations via code with the `TranslatorService`:
Access translations via code with `TranslateService`
```typescript

@@ -155,16 +149,54 @@ import {TranslateService} from "dfx-translate";

### Auto deep learning translation
## Auto deep learning translation
It's possible to translate not manual translated strings via
https://github.com/LibreTranslate/LibreTranslate API. LibreTranslate is an open-source, self-hostable
machine-translation service.
It's possible to translate not manual translated strings via LibreTranslate API. LibreTranslate is an open source selfhostable machine-translation
service. Visit https://github.com/LibreTranslate/LibreTranslate for more information.
dfx-translate can translate the primary language into a whole new language and will take partially manual translated
languages into account, meaning it will only translate strings which are not occurring in the manual created files
located at src/assets/i18n/LANGUAGE_CODE.json.
dfx-translate will take partially manual translated files into account. The command syntax is
Command syntax:
```bash
node ./node_modules/dfx-translate/translation/generateTranslation.js {API_URL} {SOURCE_LANGUAGE_CODE} {TARGET_LANGUAGE_CODE}
```
Note: You **never** have to auto-translate fully manual translated files
For simplicity purposes I wrote a little shell script. Put this at the top / root level of your project
in `languages.sh`
### Supported languages
LANGUAGE_CODE | name
--- | ---
en | English
ar | Arabic
zh | Chinese
fr | French
de | German
hi | Hindi
ga | Irish
it | Italian
ja | Japanese
ko | Korean
pt | Portuguese
ru | Russian
es | Spanish
Note: Keep in mind that at least one of the fully manual translated files has to be in such a language for this feature
to work.
### Example
* **Primary language: en**; **Fully translated language: de**; **Partially translated language: es**; **Not translated
language: fr**
```bash
node ./node_modules/dfx-translate/translation/generateTranslation.js https://translate.abc.abc/translate en es
node ./node_modules/dfx-translate/translation/generateTranslation.js https://translate.abc.abc/translate en fr
```
Following files should be in `src/assets/i18n/` folder.
* `en.json` - the primary language
* `de.json` - additional language, fully manual translated
* `es.json` - additional language, partially manual translated
* `es_auto.json` - additional language, auto-translated missing strings of `es.json` compared to the primary language
* `fr_auto.json` - additional language, completly auto-translated containing all translations
### Simplifying
For simplicity purposes I wrote a little shell script. Put this at the top / root level of the project
```bash

@@ -186,24 +218,21 @@ #!/usr/bin/env bash

```
Now you only have to run this script.
dfx-translate will put all auto generated properties in `src/assets/i18n/`. The file names will be something
like `de_auto.json` or `en_auto.json`.
## Development
Everything important in this library is located in `projects/dfx-translate`, thats the "real" library. (following
commands still have to be executed at the root level)
Before an production build run
### Dependency installation
```bash
npm install
```
## Supported languages
### Starting in development environment
```bash
npm run-script watch
```
code | name
--- | ---
en | English
ar | Arabic
zh | Chinese
fr | French
de | German
hi | Hindi
ga | Irish
it | Italian
ja | Japanese
ko | Korean
pt | Portuguese
ru | Russian
es | Spanish
### Building a production version
```bash
npm run-script build
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc