Mika A.

Blog Simple :)

Page 2 of 4

Easy blog post translation with Yarakuzen

I am running a bilingual blog and I have recently discover Yarakuzen. This is an innovative tool for text translation and they offer a free plan for personnal use. They also have premium plans for an extensive use.

This app is not like other translation tool but offers the ability to adjust translation as I want and save them. The more I translate my content, the more it become accurate and customized for my taste.

So to use it on my wordpress blog, I had to create an account here and generate and API key. I also downloaded the Yarakuzen wordpress plugin than is perfectly integrated to WordPress.

The plugin will ask for a public and a private key I get from my Yarakuzen account :

YarakuZen ‹ Mika A. — WordPress

Now, when I start a new post, I see a new box from the Yarakuzen plugin, it allows me to send my post content to Yarakuzen for translation.

Ajouter un nouvel article ‹ Mika A. — WordPress

This is how I use it :

  • I create my first post in any language (say english) and save it
  • I create another post for translation and paste content from source post
  • I send translation to Yarakuzen through the box and when ready
  • I click the “Retrieve translation” button from the Yarakuzen box

retrieve

This will replace my content with the translated text and it will also keep medias so I don’t need to add them again in the translation.

This is a service that is really helpful for me and I will use really often. You can learn more about Yarakuzen and their plans and services in yarakuzen.com

Travis CI configuration package for Atom

Working on a small package Atom lately, I started to configure Travis CI to automatically launch my builds and tests.This allows me to ensure that the future push and pull requests of my project do not break anything. As this is an opensource project, I can use Github free TravisCI services.

My repository is installed on Github and I started to activate webhook Travic CI in parameters. To do this, go to Settings> Webhooks & Services> Travic CI and activate this service by clicking edit button.

Webhooks Services

You must now set Travis CI. My Travis CI account is linked to my Github account so I can find the list of my repository and I chose the one that is concerned.

active

Finally, to start the work of travis, add a .travis.yml file in the root of the project. This file contains the information necessary for Travis and configuration for actions to run. Regarding the Atom packages, a repository has been deployed to easily set up Travis configurations. Just go to https://github.com/atom/ci/blob/master/.travis.yml and use it.

When I makes new push on the repository, Travis will now launch automatically builds and keep me informed in case of problems. To top it all, I can have the small button indicating the status of the repository.It can easily be integrated on a web page or on my project README 

For Atom packages, it is also possible to use other services or as AppVeyor Circle. The details for these are also available on the directoryhttps://github.com/atom/ci/

Et voila, your turn now!

Grunt task for FTP WordPress deployment

You may certainly say  “FTP??? Nooooo!!!!”. But yes, FTP is still used on many “basic” websites and I ran on of them today. I needed to deploy a WordPress website via FTP on a shared hosting server.

So to ease the job, I created a Grunt task to upload files so it can be done automatically.  If you are new to grunt, you can learn more here.  Grunt is a javascript task runner we can use it to minify files, deploy changes, run tests, etc…

You are required to install npm modules grunt, grunt-cli to run Grunt on a machine. I then searched through the web and found the very nice grunt-ftp-deploy module. We just need to make some configuration to make it work.

Let’s just create the Gruntfile.js file with the following content in your WordPress folder:

module.exports = function (grunt) {
  grunt.initConfig({
    'ftp-deploy': {
      build: {
        auth: {
          host: 'YOUR-FTP-HOST',
          port: 21,
          authKey: 'key1',
          authPath: '.ftpconfig'
        },
        src: 'YOUR-LOCAL-PATH',
        dest: 'YOUR-REMOTE-PATH',
        exclusions: ['.git*', 'node_modules', 'wp-admin', 'wp-content/uploads', '.DS_Store', 'search*', '.ftpconfig', 'wp-config*'],
        forceVerbose: true
      },
      theme: {
        auth: {
          host: 'YOUR-FTP-HOST',
          port: 21,
          authKey: 'key1',
          authPath: '.ftpconfig'
        },
        src: 'YOUR-LOCAL-PATH/wp-content/themes/THEME',
        dest: 'YOUR-REMOTE-PATH/wp-content/themes/THELE',
        exclusions: ['.git*', 'node_modules', 'wp-admin', 'wp-content/uploads', '.DS_Store', 'search*', '.ftpconfig'],
        forceVerbose: true
      }
    },
  });

  grunt.loadNpmTasks('grunt-ftp-deploy');

  grunt.registerTask('deploy', [
    'ftp-deploy'
  ]);
  grunt.registerTask('deploy:theme', [
    'ftp-deploy:theme'
  ]);
};

You will need to replace YOUR-FTP-HOST, YOUR-LOCAL-PATH, YOUR-REMOTE-PATH and THEME variables.  You will also create the .ftpconfig file to store authentication parameters as follows :

{
  "key1": {
    "username": "USERNAME",
    "password": "PASSWORD"
  }
}

I decided to create two main tasks : one to upload all files, one to upload only the specific theme files because they are often updated and I don’t need to upload all files when only theme is changed.

You can create as much tasks as you need, say to upload only plugins, languages, etc… For that, you will add a new json structure under ftp-deploy in  grunt.initConfig and a news grunt.registerTask just as in the example.

We can finally execute the main task in your console with:

$ grunt deploy

To run the theme deployment task only, use

$ grunt deploy:theme

This helped me ease the website deployment process and I hope this will be helpfull for you as well.

Page 2 of 4

Powered by WordPress & Theme by Anders Norén