Translation

Translation

LearnDash is in English and has user-donated translations. Strings in the LearnDash codebase are translatable.
You can use free software like poEdit to create and modify LearnDash translation files for your language. Or a free WordPress plugin like Loco Translate.
Table of Contents [show]1 Current Translations2 Adding (or Modifying) a Translation3 Common Issues3.1 Not Updating from Latest POT File3.2 Translations Set to 「Needs Work」3.3 Unexpected Locale3.4 Incorrect Folder3.5 Incorrect File Name3.6 Not Accounting for All Contexts3.7 Not Considering Strings from Third-Party Code3.8 Was this article helpful to you?
Current Translations
NOTE
As the translations are user-donated, they may not be 100% complete for your desired language.

Arabic (ar)
Chinese (zh_CN)
Danish (da_DK)
Dutch / Nederland (nl_NL)
French (Canada) (fr_CA)
French (France) (fr_FR)
German (de_DE)
Hebrew (he_IL)
Italian (it_IT)
Polish (pl_PL)
Portuguese (Brazil) (pt_BR)
Russian (ru_RU)
Spanish (Spain) (es_ES)
Swedish (sv_SE)

Right-to-left (RTL) languages are supported.
Adding (or Modifying) a Translation
If you are creating a new translation, you can reference this helpful list of WP Locale Codes for file naming conventions.
​If you need to update a translation, you can do so by following these steps:

​Navigate to LEARNDASH LMS > SETTINGS > TRANSLATIONS
Download the latest POT file by clicking the POT download button (it will automatically download)
Download the .po file by clicking the PO download button (it will open in a new tab)
Right click & save the file
Open the .po file with PoEdit
Navigate to CATALOG > UPDATE FROM POT and select the downloaded POT file in step 2
Make your additions and/or modifications to the translation file
Save the .po file
Regenerate the new .mo file via FILE > COMPILE TO MO
Using an FTP program or File Manager, add your new .mo and .po files to the /wp-content/languages/plugins/ folder

NOTE
Verify that the file is named correctly and in the proper directory. If one or both of these is incorrect then you will encounter issues.

Common Issues
Not Updating from Latest POT File
If you are translating strings such as 「Next Lesson」 and noticing that the translation is not reflected on your site, then that is because you are translating from an out of date POT file.
The string in the codebase of LearnDash is actually 「Next %s」 because the %s acts as a placeholder for your Custom Label (even if you do not use Custom Labels).

This may also be why you notice that all of a sudden you have 「lost」 translations of strings like 「Next Lesson」 and 「Previous Course」 and other strings that contain a custom label. However, the translation is not necessarily lost. It is no longer used because the codebase is now using placeholders in those strings, not the literal words such as Lesson or Course.
To resolve, download the latest POT (step #2), then follow steps 6-10 to update from the latest POT, add translations for the new strings as needed, and upload your new .mo/.po files to the right place.
Translations Set to 「Needs Work」
Be mindful of 「Needs Work」 settings on individual translations. This is typically indicated by an orange color, and an orange toggle after selecting the individual translation in poEdit.

When 「Needs Work」 is set on a translation, you are telling WordPress that you are not sure that this is the correct translation. Therefore, WordPress does not display this translation on your site because it thinks the translation 「Needs Work」 as per your instructions.
To resolve, toggle the 「Needs Work」 setting to off. It should look like similar to the screenshot below.

Then, save your new .mo/.po files and upload as per step 10 in the above documentation.
Unexpected Locale
WordPress translations may be localized to a particular region. For example, es_ES would be Spanish in Spain, and es_MX would be Spanish in Mexico.
As far as WordPress is concerned, these are totally different languages (technically, referred to as 「localizations」).
If your WordPress site localization is set to es_MX, then that setting will not pull any information from your es_ES translation files (even though to you, the differences in language may be minor).
Incorrect Folder
Please ensure your LearnDash translation files are in the folder path below, with the file names that include locale code. For example:

/wp-content/languages/plugins/learndash-es_ES.po
/wp-content/languages/plugins/learndash-es_ES.mo

It is not a good idea to store your customized translation files inside directories such as /wp-content/plugins/sfwd-lms/languages/ due to risk of overwrite in the event of a plugin update.
Incorrect File Name
This section is to highlight the correct file name format, already seen in the above 「Incorrect Folder」 issue.
learndash[hyphen][locale code, underscores used as separators].po
Please ensure your hyphens and underscores are in the right places. This is correct:

learndash-es_ES.po

These are not:

learndash_es_ES.po (underscore instead of hyphen is incorrectly placed between learndash and es_ES).
learndash-es-ES.po (hyphen instead of underscore is incorrectly placed between es and ES).

The .po and .mo files should be identically named, except for the file extension.
Not Accounting for All Contexts
Translating a word once does not necessarily change the word in all strings in which that word occurs.
Words used in different contexts may be the same in your language. For example, 「quiz」 may serve as both a verb and a noun in English.
Understand that other languages may use different words depending on the context, and your translation files will need to account for that on a string-by-string basis.
PoEdit and Loco Translate both have search features to ensure you are accounting for every instance of a word in the translation files.
Not Considering Strings from Third-Party Code
Not every translatable string seen on a LearnDash-related page, such as a page that contains what appears to be a Course Grid or Login Form, is from the LearnDash codebase. Therefore, you may not be able to find the word you need to translate in the LearnDash file source text.
Or maybe you do, however the string output is coincidentally duplicated in third-party code where it is actually being output.
This is especially common with WordPress themes built with LearnDash in mind, such as BuddyBoss, that override template files (or other third-party addons for LearnDash).
For example, the LearnDash source text includes the string 「Incorrect username or password. Please try again」
You change that string in your LearnDash .po file, but notice it is not reflected on your site. Other parts of your LearnDash translation are working as intended.
This may be because the string is actually output by third-party code, and is coincidentally using the same string. You would need to translate it separately.

Was this article helpful to you?

Yes

No

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注