在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):NEURS/gulp-transifex开源软件地址(OpenSource Url):https://github.com/NEURS/gulp-transifex开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-transifexGulp plugin for uploading resources and downloading translations in Transifex Feel free to fork and improve Usagevar options = {
host: <String optional. Defaults to 'www.transifex.com'>,
base_path: <String optional. Defaults to '/api/2/project/'>,
user: <String required. Transifex username>,
password: <String required. Transifex Password>,
project: <String required. Transifex projects name>,
local_path: <String optional. Local root path for the translations>,
custom_language_codes:{
<ISO 639-1 language code>: <custom language code>
},
use_custom_language_codes: <Boolean>,
language_codes_as_objects: <Boolean>,
translation_mode: <String optional. See 'https://docs.transifex.com/api/translations#downloading-and-uploading-translations'>
} Using Custom Language CodesTransifex uses ISO 639-1 to code languages. If you want to use your custom language code (another standard or just map ### [
{
<ISO 639-1 language code>: <custom language code>
},
...
] Uploading Resource files:gulp-transifex will go file by file uploading them to the project as a resource Transifex will check if the file has changed and will store the changes var transifex = require('gulp-transifex').createClient(options)
var gulp = require('gulp')
gulp.task('upstream', function(){
return gulp.src('path/to/source/language/*')
.pipe(transifex.pushResource())
}) Downloading translation files:Similarly, for every resource file, gulp-transifex will check on the server for the languages and will start going to every file in each language and copy it in the local translation folder: var transifex = require('gulp-transifex').createClient(options)
var gulp = require('gulp')
gulp.task('downstream', function(){
return gulp.src('path/to/source/language/*')
.pipe(transifex.pullResource())
}) Chaining Tasks with gulp-transifexSince this plugins makes remote requests you have to call it asynchronously if you need the translation files in next tasks, just return the stream: var transifex = require('gulp-transifex').createClient(options)
var gulp = require('gulp')
gulp.task('downstream', function(){
return gulp.src('path/to/source/language/*')
.pipe(transifex.pullResource())
});
gulp.task('requireTransifexFiles', ['downstream'], function () {
...
}); Other methods exposedThere are other methods exposed that doesn't return streams but accepts callbacks: ###resources() Gets an array of resources in the project var transifex = require('gulp-transifex').createClient(options)
transifex.resources(function(data){
...
}) ###languages() Gets an array of language codes in the project var transifex = require('gulp-transifex').createClient(options)
transifex.languages(function (data){
...
}) TODO
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论