grinder_smartling 0.1.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 26

Grinder-Smartling

Runtime Release License Coverage Build

Grinder plug-in dedicated to the synchronization of translations with the Smartling service, based on the File API v2.

Getting started

If you haven't used Grinder before, be sure to check out the related documentation, as it explains how to create a grind.dart file and to define project tasks. Once you're familiar with that process, you may install this plug-in.

Installing via Pub

1. Depend on it

Add this to your package's pubspec.yaml file:

devDpendencies:
  grinder_smartling: *

2. Install it

Install this package and its dependencies from a command prompt:

$ pub get

Once the plug-in has been installed, it may be enabled inside your grind.dart file.

Usage

The plug-in lets you synchronize translations with the Smartling service. Two functions are dedicated to this feature:

  • download(): Downloads the message translations from the remote server.
  • upload(): Uploads the source messages to the remote server.

These functions require four named parameters:

  • String fileUri : A value that uniquely identifies the remote file.
  • String projectId : The project identifier.
  • String userId : The identifier used to identify the API user.
  • String userSecret : The secret used to authenticate the API user.

Download the message translations from the Smartling service

The download() function takes a file pattern and a list of locales as inputs, indicating the path of the downloaded files and their target language. The {{locale}} placeholder will be replaced by the locale of each file.

import 'dart:async';
import 'package:grinder/grinder.dart';
import 'package:grinder_smartling/grinder_smartling.dart' as smartling;

@Task('Download the message translations from the Smartling service')
Future i18nDownload() => smartling.download(
  'path/to/i18n/{{locale}}.json', ['es-ES', 'fr-FR', 'ja-JP'],
  fileUri: '/Gulp-Smartling/messages.json',
  projectId: 'FooBar',
  userId: 'john.doe',
  userSecret: 'MyPassword'
);

The supported options are:

  • bool includeOriginalStrings = false : A value indicating whether to return the original string when no translation is available.
  • String retrievalType = "published" : The desired format for the download.

Upload the message source to the Smartling service

The upload() function takes a file path as input, specifying the message source to be uploaded.

import 'dart:async';
import 'package:grinder/grinder.dart';
import 'package:grinder_smartling/grinder_smartling.dart' as smartling;

@Task('Upload the source messages to the Smartling service')
Future i18nUpload() => smartling.upload(
  'path/to/i18n/en-US.json',
  fileUri: '/Gulp-Smartling/messages.json',
  projectId: 'FooBar',
  userId: 'john.doe',
  userSecret: 'MyPassword'
);

The supported options are:

  • bool authorize = false : A value indicating whether content in the file is authorized in all locales.
  • dynamic callbackUrl = null : The URL of the callback called when the file is 100% published for a locale.
  • String fileType = "" : The file type. If empty, will be guessed from the extension of the input file.

See also

License

Grinder-Smartling is distributed under the Apache License, version 2.0.

Changelog

This file contains highlights of what changes on each version of the Grinder-Smartling package.

Version 0.1.0

  • Initial release.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  grinder_smartling: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:grinder_smartling/grinder_smartling.dart';
  
Version Uploaded Documentation Archive
0.1.0 Jun 3, 2017 Go to the documentation of grinder_smartling 0.1.0 Download grinder_smartling 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
56
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
45
Overall:
Weighted score of the above. [more]
26
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: other

Primary library: package:grinder_smartling/grinder_smartling.dart with components: io, mirrors.

Health issues and suggestions

Fix lib/src/client.dart. (-44.03 points)

Analysis of lib/src/client.dart failed with 2 errors, 1 hint:

line 28 col 18: Undefined name 'JSON'.

line 104 col 16: Undefined name 'JSON'.

line 36 col 31: 'CONTENT_TYPE' is deprecated and shouldn't be used.

Fix lib/grinder_smartling.dart. (-0.50 points)

Analysis of lib/grinder_smartling.dart reported 1 hint:

line 5 col 8: Unused import: 'dart:convert'.

Format lib/src/file_type.dart.

Run dartfmt to format lib/src/file_type.dart.

Fix additional 6 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/locale.dart (Run dartfmt to format lib/src/locale.dart.)
  • lib/src/retrieval_type.dart (Run dartfmt to format lib/src/retrieval_type.dart.)
  • lib/src/task.dart (Run dartfmt to format lib/src/task.dart.)
  • lib/src/tasks/download_task.dart (Run dartfmt to format lib/src/tasks/download_task.dart.)
  • lib/src/tasks/file_task.dart (Run dartfmt to format lib/src/tasks/file_task.dart.)
  • lib/src/tasks/upload_task.dart (Run dartfmt to format lib/src/tasks/upload_task.dart.)

Maintenance issues and suggestions

Use analysis_options.yaml. (-10 points)

Rename old .analysis_options file to analysis_options.yaml.

Read more about the setup of analysis-options.yaml.

Package is getting outdated. (-35.07 points)

The package was released 70 weeks ago.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use grinder_smartling.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.23.0
grinder ^0.8.0 0.8.3
http ^0.11.3 0.11.3+17 0.12.0
meta ^1.0.5 1.1.6
path ^1.4.1 1.6.2
Transitive dependencies
async 2.0.8
charcode 1.1.2
cli_util 0.1.3+2
collection 1.14.11
glob 1.1.7
http_parser 3.1.3
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
Dev dependencies
coverage ^0.9.2
coveralls ^1.0.0
test ^0.12.20