-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Restructuring folder structure
- Loading branch information
1 parent
842fa95
commit ab49aa4
Showing
26 changed files
with
3,266 additions
and
6,192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules/ | ||
dist/ | ||
tests/ | ||
coverage/ | ||
types/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# These are supported funding model platforms | ||
|
||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
polar: # Replace with a single Polar username | ||
buy_me_a_coffee: gabriellogan | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
# Upload entire repository | ||
path: './docs' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
node_modules/ | ||
private/ | ||
dist/ | ||
types/ | ||
tsconfigcopy.json | ||
geraTraducoes.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
typescript/ | ||
.vscode/ | ||
.github | ||
.vscode | ||
docs/ | ||
src/ | ||
tests/ | ||
.editorconfig | ||
.eslintignore | ||
.eslintrc.js | ||
.gitignore | ||
.prettierrc.js | ||
.prettierrc | ||
*.html | ||
*.css | ||
CONTRIBUTING.md | ||
geraTraducoes.js | ||
jest.config.js | ||
package-lock.json | ||
tsconfigcopy.json | ||
*.lock | ||
tsconfig.json | ||
private/ | ||
jest.config.js | ||
tests/ | ||
.npmignore | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
# Azure Translator Code | ||
|
||
The Azure Translator Code library is a powerful tool for translating JSON files into multiple languages using the Azure Cognitive Translator service. This library supports translation of JSON files in multiple folders or within a single folder, depending on your needs. | ||
|
||
[![npm version](https://badge.fury.io/js/azure-translator-code.svg)](https://badge.fury.io/js/azure-translator-code) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
[![npm downloads](https://img.shields.io/npm/dm/azure-translator-code.svg?style=flat-square)](https://npm-stat.com/charts.html?package=azure-translator-code) | ||
|
||
<p align="center"> | ||
<a href="https://www.buymeacoffee.com/gabriellogan" target="_blank"> | ||
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" > | ||
</a> | ||
</p> | ||
|
||
NPM PAGE: https://www.npmjs.com/package/azure-translator-code | ||
|
||
GITHUB PAGE: https://github.com/gabriel-logan/Azure-translator-code | ||
|
||
## Installation | ||
|
||
To get started, you can install the library via npm: | ||
|
||
As devDependencies | ||
```bash | ||
npm install -D azure-translator-code | ||
``` | ||
or | ||
|
||
As dependencies | ||
```bash | ||
npm install azure-translator-code | ||
``` | ||
|
||
You also can use yarn | ||
|
||
```bash | ||
yarn add azure-translator-code | ||
``` | ||
|
||
## Usage | ||
|
||
You can import the JSON file you want to translate in two different ways: | ||
|
||
### Importing a JSON File | ||
|
||
```javascript | ||
const jsonFile = require('./jsonFileToTranslate/en.json'); | ||
|
||
// or | ||
|
||
// IMPORTANT | ||
// The file must follow this structure. | ||
const jsonFile = { | ||
"translation": { | ||
"welcome": "Welcome", | ||
"hello": "Hello", | ||
} | ||
}; | ||
``` | ||
|
||
Now, you can use the library to translate the JSON file into multiple languages: | ||
|
||
```javascript | ||
const { translateToMultipleFolders, translateToUnicFolder } = require('azure-translator-code'); | ||
``` | ||
or | ||
```javascript | ||
import { translateToMultipleFolders, translateToUnicFolder } from 'azure-translator-code'; | ||
``` | ||
|
||
```javascript | ||
const key = 'sds12312a213aaaa9b2d0c37eds37b'; // REPLACE WITH YOUR OWN KEY HERE | ||
const endpoint = 'https://api.cognitive.microsofttranslator.com/'; | ||
const location = 'eastus'; | ||
const fromLang = 'en'; | ||
const toLangs = [ | ||
'pt', | ||
'de', | ||
'es', | ||
'fr', | ||
'it', | ||
'ja', | ||
'ko', | ||
'nl', | ||
'ru', | ||
'zh', | ||
'pt-pt', | ||
'ar', | ||
'tlh-Latn' | ||
]; | ||
|
||
const jsonFile = { | ||
"translation": { | ||
"welcome": "Welcome", | ||
"hello": "Hello" | ||
} | ||
}; | ||
|
||
// Translation to multiple folders | ||
translateToMultipleFolders(key, endpoint, location, fromLang, toLangs, jsonFile); | ||
// This function will return a folder called multiFolderGeneratedTranslations | ||
|
||
|
||
|
||
// Translation to a single folder | ||
translateToUnicFolder(key, endpoint, location, fromLang, toLangs, jsonFile); | ||
// This function will return a folder called unicFolderGeneratedTranslations | ||
``` | ||
|
||
#### You can also choose the folder or folder name where you will save the files. | ||
##### Saving always starts from the project root folder. | ||
|
||
```javascript | ||
const { translateToMultipleFolders, translateToUnicFolder } = require('azure-translator-code'); | ||
|
||
const key = 'sds12312a213aaaa9b2d0c37eds37b'; // REPLACE WITH YOUR OWN KEY HERE | ||
const endpoint = 'https://api.cognitive.microsofttranslator.com/'; | ||
const location = 'eastus'; | ||
const fromLang = 'en'; | ||
const toLangs = ['pt', 'de']; | ||
|
||
const jsonFile = { | ||
"translation": { | ||
"welcome": "Welcome", | ||
"hello": "Hello", | ||
} | ||
}; | ||
|
||
// IMPORTANT: If you use '../../' it will try to save to a location before the root folder | ||
|
||
// Translation to multiple folders | ||
translateToMultipleFolders(key, endpoint, location, fromLang, toLangs, jsonFile, 'myFolder'); | ||
// This function will return a folder called myFolder | ||
|
||
|
||
// Translation to a single folder | ||
translateToUnicFolder(key, endpoint, location, fromLang, toLangs, jsonFile, 'myFolder/OtherFolder/etc'); | ||
// This function will return a folder called ./myFolder/OtherFolder/etc | ||
|
||
|
||
// Translation to a single folder | ||
translateToUnicFolder(key, endpoint, location, fromLang, toLangs, jsonFile, './myFolder/OtherFolder/etc'); | ||
// This function will return a folder called ./myFolder/OtherFolder/etc | ||
``` | ||
|
||
Make sure to replace the key and endpoint information with your own Azure access credentials. Ensure that the JSON file and settings are correctly defined according to your needs. | ||
|
||
Contributing | ||
If you wish to contribute to this project, feel free to open an issue or submit a pull request on our GitHub repository. | ||
|
||
<p align="center"> | ||
<a href="https://www.buymeacoffee.com/gabriellogan" target="_blank"> | ||
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" > | ||
</a> | ||
</p> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
ab49aa4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice