PluginsHelp

From IniTranslator

Revision as of 17:24, 25 November 2007; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

{This page is under construction. Please help out making it complete!}

For information on writing plugins, see WritingPlugins.


Contents

ResX Plugin

The ResX plugin reads and writes .Net resx files. This is an XML file that can contain three "types" of data: strings, serialized objects (icons and similar) and metadata (anything localizable that is neither string nor objects, like dimensions and position). By default, the plugin only imports strings, but you can configure it to import the other two types of data as well.

To import serialized objects, set the mimetypes entry in the resxplugin.ini (in the plugins folder) to one or more of the supported mimetypes. Currently, the .Net serializer can write any of the following mimetypes in the resx file:

  • application/x-microsoft.net.object.binary.base64
  • application/x-microsoft.net.object.soap.base64
  • application/x-microsoft.net.object.bytearray.base64

To specify more than one mimetype, separate entries with a comma. Make sure all mimetypes are on a single line!

To import metadata nodes, set the metadata entry in resxplugin.ini to 1.

String nodes are always imported.

Restrictions and notes

  • The plugin does not convert the data of serialized objects.
  • Nodes missing from the translation file are added at the end of the exported file, not where they appeared in the original file. This should not cause any functional problems although it will make it harder to diff the files. You can manually move the items to their correct position with any text editor if this bothers you.
  • The encoding of the translation file when importing is restored when exporting. If no encoding was specified, the exported file is encoded as UTF-8
  • Sometimes multiple metadata nodes have the same name in a resx file (for example UserAddedColumn nodes have this property). This is not supported. You will have to edit these files using some other editor if that is the case.

IB Forums Plugin

The IB forums plugin is used to import php language files as used by the Invision Board Forum. A typical IB Forums translation file looks something like this:

<?php
$lang = array (
'gzip_on' => "GZIP Enabled",
'gzip_off' => "GZIP Disabled",
/* and/or */
ba_edit => "Edit",
ba_delete => "Delete",
/* etc */
);
?>

This format is also supported (translated file format):

<?php
$lang['by']  = "By";
$lang['newslink']  = "latest news:";
?>

Restrictions

  • All comments are stripped
  • Embedded quotes are not supported
  • No character escaping is performed

Mozilla DTD Plugin

This is the format used for localization files in the Mozilla project. You can find more information about localizing the various Mozilla projects here. This plugin reads strings in the following format:

<!ENTITY messengerWindow.title "Mail & Newsgroups">
<!ENTITY titleModifier.label "&brandShortName;">
<!ENTITY titleSeparator.label " - ">

Note

There are many tools specifically developed to edit Mozilla language files. You can find out more about them at the link above.


Mozilla Properties Plugin

This is another format used by the Mozilla projects. It is very simple and looks a lot like standard ini-files although it doesn't have any section headers:

# LOCALIZATION NOTES(EMLFiles): Do not translate "*.eml" in the line below
EMLFiles=Mail Files (*.eml)

Lines starting with a # are ignored.


MS Dictionary Parser Plugin

According to Microsoft, glossaries contain the following five mandatory columns:

Source Term, Translation (also called Target Term), String Category, Platform (also called Environment), Product

In practice, I've found that the glossaries actually has this format:

Source Term, ShortCut Letter, Translation, ShortCut Letter, String Category, Environment, Product

The plugin imports the Source Term and the Translation only, but preserves the other items to be able to recreate the file correctly when exporting.

Noteworthy

  • All items can be empty and are sometimes enclosed in double-quotes, sometimes not (even if they contain spaces).
  • Items are always enclosed in quotes if they contain commas.
  • Items can have embedded quotes of the same type that encloses the item. In those cases, the end of an item is detected by checking for a comma after the quote char.
  • The files can (and often do) contain exact duplicate items.
  • The two first lines often (but not always) contains a Copyright notice and an empty line.
  • The files are saved as Unicode.

Note

In some cases an item is split on several lines. This parser cannot handle those items. To import such a file, you will have to first manually edit it (in an editor that supports Unicode, like WordPad), removing the unwanted CRLF's.

You can get the MS Glossary files from Microsofts ftp site.


Oleg Plugin

The Oleg file format is very simple: each row is a TAB delimited list of original and translation item.

File	Arkiv
Open	Öppna

This plugin was written per request from a user.


OOGSI Plugin

The OOGSI plugin imports OpenOffice GSI files (for more info on OOGSI, see this link.

A basic GSI file is an UTF-8 file (with BOM) where each row is a TAB delimited list of data items. Here's an example:

avmedia	source\framework\mediacontrol.src	0	string	AVMEDIA_STR_OPEN				0	en-US	Open				20060213 15:38:55
avmedia	source\framework\mediacontrol.src	0	string	AVMEDIA_STR_INSERT				0	en-US	Apply				20060213 15:38:55


We are really only interested in item #5 (AVMEDIA_STR_OPEN, AVMEDIA_STR_INSERT) which is the identifier and #8 (Open, Apply) which is the actual string.

GSI files come in two flavours: either they are "single line" files, in which case every row of the file contains the original text, or they are "dual line" files, in which case every other line is the original and the other is the translation. This is handled by prompting the user to specify what type of file is loaded when the import is done.

Note

When exporting, only single line GSI files are created, i.e the original strings in one file and the translations in another file.


PHP Nuke Plugin

THe PHP Nuke plugin can import both PHP Nuke (obviously) and Joomla translation files. A typical PHP Nuke file looks like this:

define("_SEND","Send");
define("_URL","URL");
/* etc */

The items of a Joomla file looks something like this:

DEFINE("_DML_ORPHANS" 			, "Orphans");
DEFINE("_DML_ORPHANS_LINKED" 	, "File(s) not deleted. Cannot delete file(s) linked to documents.");
DEFINE("_DML_ORPHANS_PROBLEM" 	, "File(s) not deleted. There is a problem with the file permissions.");
DEFINE("_DML_ORPHANS_DELETED" 	, "File(s) deleted.");
DEFINE("_DML_LOCALNAMETT" 		, "Enter the local name of the file as you wish it stored on this system."
    . "This is a required field as the URL does not give sufficient information for the document.");
 DEFINE("_DML_CFG_ERR_DOCPATH"	, 'Tab [' . _DML_GENERAL . '] \ . _DML_CFG_PATHFORSTORING . '\' must be provided.');
 DEFINE("_DML_CFG_ERR_PERPAGE"	, 'Tab [' . _DML_FRONTEND . '] \ . _DML_CFG_NUMBEROFDOCS . '\' must be numeric and greater than zero');
/* etc */

Note

Joomla files sometimes contain multiple lines of text (this is encoded as a line starting with a dot). The plugin has (very) limited support for this. Since IniTranslator doesn't handle multi line items, the solution is to store the additional lines in the next items comment area! I realize this seems weird, but is the best I can do.

Items can be enclosed in single or double quotes. Comments are preserved.


Generic PHP Plugin

The generic PHP plugin handles files of the following format:

<?php
/* $Id: english-iso-8859-1.inc.php3,v 1.124 2003/08/27 17:07:25 nijel Exp $ */

$charset = 'iso-8859-1';
$text_dir = 'ltr'; // ('ltr' for left to right, 'rtl' for right to left)
$left_font_family = 'verdana, arial, helvetica, geneva, sans-serif';
$right_font_family = 'arial, helvetica, geneva, sans-serif';
$number_thousands_separator = ',';
$number_decimal_separator = '.';
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
$byteUnits = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
/* etc */
?>

Restrictions

  • All comments are stripped
  • Embedded quotes are not supported
  • No character escaping is performed


PO Plugin

This plugin imports PO files and correctly handles the header at the top of the PO file, i.e:

msgid ""
msgstr ""
"Project-Id-Version: dbisam3\n"
"POT-Creation-Date: 2003-03-03 20:47\n"
"PO-Revision-Date: 2003-06-10 19:11+0100\n"
"Last-Translator: Peter Thornqvist <peter3@peter3.com>\n"
"Language-Team: swedish <swedish>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "&Add"
msgstr "&Lägg till"

msgid "&Cancel"
msgstr "&Avbryt"

...

Restrictions

  • Does not support plural forms


SciTE Plugin

The SciTE plugin imports SciTE language files. This format is identical (as far as I know, anyway) to the Mozilla Properties format:

# Define the encoding of this file so that on GTK+ 2, the file can be
# reencoded as UTF-8 as that is the GTK+ 2 user interface encoding.
# A common choice for European users is LATIN1. For other locales look at
# the set of encodings supported by iconv.
translation.encoding=LATIN1

# Menus

# File menu
File=Arkiv
New=Nytt
Open=Öppna
Open Selected Filename=Öppna vald fil
Revert=Återgå
Close=Stäng
... 

Personal tools