WooCommerce Bookings Availability includes files you can use to create translations. See Translating WooCommerce Extensions for general guidance.
Note:
This is a developer-level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customization work. We are unable to provide support for customization under our Support Policy.
Bundled translations of WooCommerce Bookings Availability are managed via glotpress on translate.wordpress.com and you can make a contribution there. If a translation is available for your site’s language it can be downloaded in your site’s admin area at Dashboard > Updates.
To make your own translation of WooCommerce Bookings Availability, you can use a localization plugin like Loco Translate, or create the translation files manually.
Create WordPress translation files
↑ Back to topIf you opt to make your own localization, there are two primary steps.
- Create standard WordPress translation files.
- Generate JSON catalogs when you need to translate JavaScript strings.
The command-line examples below require server access and WP-CLI with its i18n commands.
Step 1: Find the .POT file
↑ Back to topThe woocommerce-bookings-availability.pot file is a template of source strings in the plugin’s /woocommerce-bookings-availability/languages/ directory. Use it to create a translation for your locale.
To translate the shipped plugin, use its existing POT file and continue to Create PO and MO files. If you’ve changed source strings and need a new template, you can generate one from a working copy of the plugin.
If you need a new POT file after changing source strings, run the following command from the plugin root in your working copy:
php -d memory_limit=512M "$(which wp)" i18n make-pot . languages/woocommerce-bookings-availability.pot --exclude="assets/,bin/,*.js.map"
Where $(which wp) is a shell command that, when evaluated, should point to your wp cli command. If it does not work, replace it with a full path to your wp cli.
Depending on your system, the part:
php -d memory_limit=512M
may not be necessary and you could start the command with wp
Unfortunately, the default memory limit is sometimes not enough to parse .js files, so the limit would need to be raised. More at: How to raise the default memory limit.
Step 2: Generate PO and MO files
↑ Back to topNow that you have the .POT file, plugin translation can start. It can be done manually, but this is tedious. More at: Translating a plugin manually.
An easier approach is to use a translation plugin, such as Loco Translate.
Translation plugins usually are able to generate both PO files and MO files, which is what you need. If they only generate PO files or one has created files manually, then the MO files would need to be generated. More at: Generate MO files.
Consult documentation for the translation plugin of your choice to learn how to add translations.
Use filenames such as woocommerce-bookings-availability-nl_NL.po and woocommerce-bookings-availability-nl_NL.mo for Dutch (Netherlands). Keep a backup of the editable PO file. Don’t rely on custom files inside the installed plugin directory: an extension update can replace that directory. WordPress also looks for plugin language files in wp-content/languages/plugins/, but a language-pack update or translation tool can replace files there too. Follow your tool’s instructions and test your workflow before updating.
Generate .json translation files
↑ Back to topThe wp i18n make-json command reads PO files with JavaScript source references; it doesn’t use MO files as input or translate strings. Command behavior depends on the installed WP-CLI i18n package: some versions remove JavaScript entries from the input PO by default, while newer versions preserve it. Back up the PO, check your installed command’s help, and run the command on a working copy:
wp i18n make-json /path/to/working-copy
Replace the path with your working directory. A PO file without JavaScript source references may produce no JSON files. Set the site language to the translated locale and check the calendar, including navigation and loading text. If a string remains untranslated, check the PO translation, JavaScript references, generated filename and catalog loaded by WordPress. A bundled catalog registered through the plugin’s explicit path can take precedence over one in the global languages directory; verify your translation tool’s behavior and retest after updating.
Questions and support
↑ Back to topSomething missing from this documentation? Still have questions and need assistance?
- If you have a question about a specific extension or theme you’d like to purchase, contact us to get answers.
- If you already purchased this product and need some assistance, get in touch with a Happiness Engineer via our support page and select this product’s name from the Product dropdown.