evanburbidge / i18n-cloud-sync Goto Github PK
View Code? Open in Web Editor NEWAllows you to sync translations files with cloud providers.
Allows you to sync translations files with cloud providers.
CSV
YAML
XML
etc
as it says on tin
Hi Evan,
Nice work. Hope it will make its way to a common standard for the community.
I would suggest to use a restful approach to treat data per domain as collections.
## Endpoints
GET `/health`
- will run a health check to see the server is running
GET `/locales`
- will return an overview of available locations
- `curl -i localhost:3000/locales`
\```json
{
"locales": [
{
"id": "en", // e.g. ("en-UK", "pt-BR", "es-ES"),
"links": {
"self": "{domain}/locales/{id}", // where {id} would match the value above
"s3": "{s3_domain_and_path}/{id}.json",
}
}
]
}
\```
GET `/locales/{id}`
- will return the assets available at that location
- `curl -i localhost:3000/locales/en -> {... some translations}`
\```json
{
"locale": {
"id": "en",
"translations": {
"App": {
"hello": "Hello World"
}
}
},
"links": {
"self": "{domain}/locales/{id}", // where {id} would match the value above
"s3": "{s3_domain_and_path}/{id}.json",
}
}
\```
POST `/locales`
- must includes a translations object in the body
- will update the given location with data passed into it via the request body
- `curl -d { "locale": { "id": "en", "translations": { "key": "translation" } } } -X POST localhost:3000/locales`
- status: `201 Created`
PATCH `/locales/{id}`
- will update configuration locations in your config file
- `curl -d { "id": "en", "translations": { "key": "some other value" } } -X PATCH localhost:3000/locales/en`
- status: `200 OK`
DELETE `/locales/{id}`
- not to be used very often only when removing or deprecating old translations
- `curl -X DELETE localhost:3000/locales/en`
- status: `204 No Content`
PATCH `/config/locales/{id}`
- will update specific configuration based on locale id
- `curl -d { "id": "en", "s3_domain":"s3://mycdn.com/" } -X PUT localhost:3000/config/locales/en`
- status: `200 OK`
PATCH `/config/locales`
- will update default configuration and it would fallback to this in case there is not specific config
- `curl -d { "s3_domain":"s3://mycdn.com/" } -X PUT localhost:3000/config/locales`
- status: `200 OK`
As you can see, PUT was gone from /locales
due to be covered for PATCH updates. It does not mean, you need to remove PUT, I thought it would not be necessary and I might be wrong ;)
With it, we have 3 restful resources
/locales
/config/locales
/config
Each one with its own purpose. Please, you may have different goals/directions to evolve this project and, then, this suggestion wouldn't make sense.
I hope this help you though.
Nicely done again and keep up the good work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.