Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
ab-translate
Advanced tools
Quickly create AB Tests for texts without coding via [Wix Babel](https://bo.wix.com/wow/babel) & [Guineapig (Petri)](https://bo.wix.com/petri).
Quickly create AB Tests for texts without coding via Wix Babel & Guineapig (Petri).
The process requries two simple steps:
messages_en.json
file in the git repopetri-specs
or Grunt petriExperiments
task create a new spec once find the key in your messages_en.json
fileDo this once, for each project that you want to run translations tests in
Install the package npm i ab-translate --save
or yarn add ab-translate
Configure the specs defaults for petri-specs
in .petrirc
/petri.config.js
file
// .petrirc
{
"abTranslate": {
"onlyForLoggedInUsers": false, // default: true
"scopes": ["my-projects-translation-scope"] // default: [<artifactId>]
}
}
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
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 JSON.parse(translations);
}
}
}
In case Universal project is used with SSR, the change needs to be on the middleware-i18n.js
instead, see example here
Install the package bower install ab-translate --save
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>]
}
});
Add the Angular abTranslateProvider
to your index.vm
file (example)
<script src="bower_components/ab-translate/abTranslate.angular-runtime.bundle.min.js"></script>
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', ['wix.ab-translate'])
.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);
});
Go to the Babel translation system
Select your project in the Current Project
dropdown and select the Update
tab
Look for the translation key you want to create a test for and click on the Edit
icon button
Click on the + Add AB test to Key
button at the bottom of the modal
Pick spec name or create a new one.
shorterSubTitle
will become specs.abTranslate.<my-projects-translation-scope>.abSpec-shorterSubTitle
)<my-projects-translation-scope>
is the one defined in package.json
-> yoshi
-> petriScopes
(or artifact id by default).Add as many alternatives as you want
Click the Save changes
button.
Babel will add new keys in format:
{
"<translatioKey>": "<Your Default A translation variant>",
// New added keys
"<translatioKey>|abTranslate_1|<yourSpec>": "<Your B translation variant>",
"<translatioKey>|abTranslate_2|<yourSpec>": "<Your C translation variant>",
}
A "AB"
sign should appear next to your key. You can pick your AB Specs from the list
The changes will be pushed to github and a new build will be triggered. The new AB test will be detected and will be created.
After the Build of the project you'll be able to see the spec in Guineapig. The spec name will be in the format specs.abTranslate.<scope>.abSpec-<key>
.
Create an experiment and use Petri Sidekick to verify the variations!
Note1: When creating the experiment verify that you open it only for the languages where the keys were updated
Note2: If the experiment is paused/killed/theres a bug in the system the first alternative (String #0) will be chosen so there shouldn't be any risks with this mechanism.
Creating an experiment in other languages is possible, however there's a few things you should keep in mind:
FAQs
Quickly create AB Tests for texts without coding via [Wix Babel](https://bo.wix.com/wow/babel) & [Guineapig (Petri)](https://bo.wix.com/petri).
The npm package ab-translate receives a total of 685 weekly downloads. As such, ab-translate popularity was classified as not popular.
We found that ab-translate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.