Skip to content

Commit

Permalink
chore: Restructuring folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-logan committed Apr 5, 2024
1 parent 842fa95 commit ab49aa4
Show file tree
Hide file tree
Showing 26 changed files with 3,266 additions and 6,192 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
tests/
coverage/
types/
14 changes: 14 additions & 0 deletions .github/FUNDING.yml
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']
43 changes: 43 additions & 0 deletions .github/workflows/static.yml
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
node_modules/
private/
dist/
types/
tsconfigcopy.json
geraTraducoes.js
23 changes: 14 additions & 9 deletions .npmignore
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# azure-translator-code - Contribution Guide
# Azure-translator-code - Contribution Guide

The azure-translator-code is a powerful Multilanguage library for validating form fields in multiple languages. This guide describes the guidelines for contributing to the project efficiently and effectively.

Expand All @@ -12,7 +12,7 @@ The azure-translator-code is a powerful Multilanguage library for validating for
```
git clone https://github.com/gabriel-logan/azure-translator-code.git
```

4. **Commit and Push**
- Commit your changes and push them to the forked repository:
```
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ npm install azure-translator-code
You also can use yarn

```bash
yarn add install azure-translator-code
yarn add azure-translator-code
```

## Usage
Expand Down
File renamed without changes.
155 changes: 155 additions & 0 deletions docs/README.md
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>
1 change: 0 additions & 1 deletion javascript/addInto/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions javascript/index.js

This file was deleted.

Loading

1 comment on commit ab49aa4

@gabriel-logan
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Please sign in to comment.