Translating documents

This is a guide for advanced users.

Invoice language

By default, the invoice language is set based on the current language in the WordPress panel. If you do not have invoice translation for other languages, the default invoice language will be English.

You can set a fixed value for the invoice language and print invoices in the selected language. Apply the action for this purpose:

add_action( 'flexible_invoices_pre_generate_pdf', 'my_flexible_invoices_pre_generate_pdf' ); function my_flexible_invoices_pre_generate_pdf( $invoice ) { global $locale; $locale = 'en_US'; unload_textdomain( 'flexible-invoices-woocommerce' ); load_plugin_textdomain( 'flexible-invoices-woocommerce', false, 'flexible-invoices-woocommerce/lang/' ); unload_textdomain( 'flexible-invoices' ); load_plugin_textdomain( 'flexible-invoices', false, 'flexible-invoices/lang/' ); unload_textdomain( 'woocommerce' ); load_plugin_textdomain( 'woocommerce', false, 'woocommerce/i18n/languages/' ); }

WPML Translations

Flexible Invoices plugin is compatible with WPML plugin and ready for translations. The invoices will be issued in the language of a user session during placing an order in WooCommerce. The text below will explain how the translation works and hot to introduce WPML support for Flexible Invoices in your WooCommerce store.

WPML & Flexible Invoices for WooCommerce

WPML logo

Invoices that you issue for WooCommerce orders will always be saved in a language in which the order was placed during the WPML session.

All of the fields visible on the invoice can be translated. Furthermore, the plugin also supports the translations of:

  • VAT number field in the checkout form
  • Order items
  • Shipping method
  • Payment method
  • E-mails with an invoice download link that are sent to the customers
  • Download link in the My Account section of your site

Adding the translations

During the configuration of the plugin, you can adjust the phrases which can be edited (eg. Invoice Prefix). You can only edit them using the default site Language. For languages different than default, fields won't be editable - you should use the String Translation tool to translate them:

Flexible Invoices WooCommerce WordPress WPML - Adding String Translations

In order to add translations for Flexible Invoices phrases, use the String Translation tool, just like translating any other plugin. Open String Translation screen and add translated phrases:

Flexible Invoices WooCommerce WordPress WPML String Translation

Text domains you should be using while working with translations:

  • flexible-invoices
  • flexible-invoices-woocommerce

Flexible Invoices for WordPress

If you decide to issue an invoice which won't be related to WooCommerce order ( using Invoices -> Add New ), the invoice language will be the same as logged in user's language which generates the invoice.

Still need help? Contact Us Contact Us