Socket
Socket
Sign inDemoInstall

@frc/laravel-mix-wp-translate

Package Overview
Dependencies
217
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @frc/laravel-mix-wp-translate

Laravel Mix extension to translate WordPress themes


Version published
Maintainers
3
Install size
22.5 MB
Created

Readme

Source

Laravel Mix extension to translate WordPress themes

If you are getting weird errors like:

Warning: Failed to set locale category LC_NUMERIC to en_FI.
Warning: Failed to set locale category LC_TIME to en_FI.
Warning: Failed to set locale category LC_COLLATE to en_FI.
Warning: Failed to set locale category LC_MONETARY to en_FI.
Warning: Failed to set locale category LC_MESSAGES to en_FI.

You need to set LC_ALL (I used en_US.UTF-8):

# Bash -> ~/.bash_profile 
# Zsh (Z shell) ->  ~/.zshrc
export LC_ALL=en_US.UTF-8
const mix = require( 'laravel-mix' );
require('laravel-mix-wp-translate');

const themes = ['frc-theme']; //folder name(s)
const languages = ['fi', 'sv_SE']; // language(s)
const options = {
    basePath: '/themes' //path to themes folder from content root path, default is '/themes'
};

// Heroku does not have msgmerge and/or msgfmt available hence..
if ( !mix.inProduction() ) {
    mix
        // creates pot file to `${options.basePath}/themes[]/languages/themes[].pot` 
        // from files in `${options.basePath}/themes[]/**/*.php`
        // options is not required
        // uses wp cli so you should have that
        .pot(themes, options)
        // creates `${options.basePath}/themes[]/languages/${languages[]}.po` files 
        // from `${options.basePath}/themes[]/languages/themes[].pot` file
        // options is not required
        // uses msgmerge so you should have that
        .pot2po(themes, languages, options)
        // creates `${options.basePath}/themes[]/languages/${languages[]}.mo` files 
        // from `${options.basePath}/themes[]/languages/*.po`
        // options is not required
        // uses msgfmt so you should have that
        .po2mo(themes, options);
}

PRs welcomed.

Keywords

FAQs

Last updated on 14 Dec 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc