Poedit plugin9/19/2023 ![]() ![]() ![]() For example, in English if you wish to display how many messages a user has you would have the following forms: Plural FormsĪ plural form is a rule that determines how a language pluralizes a particular word. You should update this section to reflect your target language, pluralization (see next section), and yourself. The top of this file contains ‘header’ information describing the localization. "Content-Type: text/plain charset=CHARSETn" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONEn" Msgstr "Project-Id-Version: PACKAGE VERSIONn" # This file is distributed under the same license as the PACKAGE package. # Copyright (C) YEAR THE PACKAGE’S COPYRIGHT HOLDER An output POT file called messages.po will be produced: Note that the second line is displayed across two lines, but should be executed on one. ![]() keyword=_ngettext:1,2 -s -n -from-code=UTF8 -f files.tmp Xgettext -language=PHP -indent -keyword=_ -keyword=_e \ From a terminal, change to the theme directory and enter the following commands: Using gettext to produce a POT file is similar to poEdit but without all the niceties of a graphical interface. This file will contain a list of all localizable text, and poEdit will display this in its main window ready for you to move on to step 2. POT file stored wherever you told poEdit to save the catalog. This is a very useful feature to stop you having to re-translate text. Note that if the plugin or theme is updated you can use poEdit to refresh this list and it will tell you what text has changed, and what text has been deleted. Press OK to accept this list and accept any messages that appear. When you save your catalog file, poEdit will automatically scan through the theme or plugin and generate a list of all localizable text: The file extension has no bearing at this point, so just chose a location and name for the file (remembering the naming conventions). Note that poEdit will save the file as a. The list of keywords matches the functions provided by WordPress and, in the case of ngettext, configures poEdit for correct pluralization.įinally you should press OK whereupon you will be prompted to save the catalog file. Note that the interface is very ‘fiddly’, and you need to select an empty row and then click the small square box to edit text (as highlighted). Specify it both in the base and as an additional path:įinally select the keywords tab and enter the following keywords to tell poEdit what is used to mark localizable text: ![]() When you’ve entered the catalog settings you should select the Paths tab and enter the full path to the location of your theme or plugin. For the moment you can leave this empty and if you discover at a later date that you do require support for plurals then you can change the catalog options and update the value. The plural forms is a complicated setting and requires a section of its own. If you do require another encoding then make sure this is clearly marked in the final output file (more details about this later). Where possible you should use UTF-8 as your character set as this is the default encoding used by WordPress and supports almost every character you could need. Character sets contain special characters that some languages need (such as letters with accents – é). The character set ( charset) encoding tells poEdit how characters in your file are stored. Fill this out as follows, changing the details as appropriate to your chosen theme or plugin and target language: A window will appear asking for catalog settings. You should download and unzip the theme or plugin from the author’s site and store it in a known location:įrom the File menu select New Catalog. You may find it easier to have WordPress installed on your own machine, but it is not essential. Sometimes this file will be provided by the theme or plugin author, but if not it can be automatically generated using gettext or poEdit.īefore you begin you will need access to the theme or plugin you want to translate. The first step involved in translating a plugin or theme is to produce a POT file, which is a list of all localizable text. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |