Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ab-translate

Package Overview
Dependencies
Maintainers
1
Versions
600
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ab-translate

Quickly create AB Tests for texts without coding via [Wix Babel](https://bo.wix.com/wix-babel-webapp/babel) & [Guineapig](https://guineapig.wix.com/home).

  • 1.1.7
  • npm
  • Socket score

Version published
Weekly downloads
110
decreased by-19.71%
Maintainers
1
Weekly downloads
 
Created
Source

ab-translate

Quickly create AB Tests for texts without coding via Wix Babel & Guineapig.

The prcess requries two simple steps:

  1. Setup - one time config for a project to support the AB Translate flow
  2. Test - create as many tests as you or you Product Manager wishes

Setup

Do this once, for each project that you want to run translations tests in

Yoshi (new stack)

  1. Install the package npm i ab-translate --save or yarn add ab-translate
  2. Configure the specs defaults in your package.json file (example):
"yoshi": {
  "petriSpecs": {
    onlyForLoggedInUsers: false, // default: true
    scopes: ['my-projects-translation-scope'] // default: [<artifactId>]
  }
}
  1. Save the petri experiments object to the window (e.g. window.__EXPERIMENTS__ = '<%= experiments %>';). Notice: make sure that you conduct the experiments for the scope in step #2
  2. In the src/i18n.js file add the following code to the backend task (example)
import abTranslate from ‘ab-translate/dist/src/abTranslate-runtime’;

backend: {
  crossDomain: true,
  parse: translations => {
    try {
      return abTranslate(window.__EXPERIMENTS__, JSON.parse(translations));
    } catch (e) {
      return translations;
    }
  }
}

Wix Grunt (old stack)

  1. Install the package npm i ab-translate --save
  2. Configure the specs defaults in your local Gruntfile.js file:
grunt.modifyTask('petriExperiments', {
  options: {
    onlyForLoggedInUsers: false, // default: true
    scopes: ['my-projects-translation-scope'] // default: [<artifactId>]
  }
});
  1. Add the Angular abTranslateProvider to your index.vm file (example)
<script src="bower_components/ab-translate.git/abTranslate.angular-runtime.bundle.min.js"></script>
  1. Transform the translations using the abTranslateProvider and the project's experimentManagerProvider (example). Notice: make sure that you conduct the experiments for the scope in step #2
angular.module('myApp', [])
  .config(function($translateProvider, abTranslateProvider, experimentManagerProvider) {
    const preferredLanguage = $translateProvider.preferredLanguage();
    const translations = $translateProvider.translations()[preferredLanguage];
    const translationsWithExperiments = abTranslateProvider.abTranslate.default(
      experimentManagerProvider.experiments,
      translations
    );
    $translateProvider.translations(preferredLanguage, translationsWithExperiments);
  });

Test

FAQs

Package last updated on 08 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc