language-manager
Advanced tools
Comparing version 0.0.7 to 0.0.9
{ | ||
"name": "language-manager", | ||
"version": "0.0.7", | ||
"version": "0.0.9", | ||
"description": "The most flexible version of multi-language management. Manages language resources. Makes it easy to switch between different language sources.", | ||
@@ -5,0 +5,0 @@ "author": "azmisahin@outlook.com", |
@@ -10,3 +10,59 @@ # language-manager | ||
``` | ||
# Add Resource | ||
Place the file containing the source language definitions in a folder. For example, "tests/resource". | ||
```shell | ||
example.com/ # → Root folder for the project | ||
└── tests/ # → Tests folder | ||
└── resource/ # → Resource Folder .setPath('tests/resource') | ||
└── json/ # → Resource Type Folder .setType(LanguageManager.ResourceType.Json) | ||
├── en-us.json # → Resource language.extention English United States | ||
└── tr-tr.json # → Resource language.extention Turkish Turkey | ||
``` | ||
## Sample Resource File | ||
en-us.json | ||
```json | ||
{ | ||
"root": { | ||
"data": [ | ||
{ | ||
"type": "string", | ||
"name": "app.name", | ||
"value": "Language Manager" | ||
}, | ||
{ | ||
"type": "string", | ||
"name": "words.ok", | ||
"value": "Okay" | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
tr-tr.json | ||
```json | ||
{ | ||
"root": { | ||
"data": [ | ||
{ | ||
"type": "string", | ||
"name": "app.name", | ||
"value": "Dil Yöneticisi" | ||
}, | ||
{ | ||
"type": "string", | ||
"name": "words.ok", | ||
"value": "Tamam" | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
# Usage | ||
@@ -13,0 +69,0 @@ |
@@ -55,5 +55,14 @@ /** | ||
/// Default require | ||
var result= require('../../' + this.File) | ||
/// Require path module | ||
var path = require('path') | ||
/// Root application | ||
this.BaseDir = process.cwd() | ||
/// Resource Path | ||
this.ResourcePath = path.join(this.BaseDir, this.File) | ||
/// Require | ||
var result = require(this.ResourcePath) | ||
/// Only string result | ||
@@ -60,0 +69,0 @@ result = JSON.stringify(result) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
100965
832
121