Overview

Namespaces

  • aliuly
    • common
      • selectors
    • loader
  • xPaw

Classes

  • ArmorItems
  • BasicCli
  • BasicHelp
  • BasicPlugin
  • ChatSession
  • Cmd
  • CmdSelector
  • ExpandVars
  • FastTransfer
  • FileUtils
  • FreezeSession
  • GetMotd
  • GetMotdAsyncTask
  • InvisibleSession
  • InvUtils
  • ItemName
  • mc
  • mc2
  • MoneyAPI
  • MPMU
  • Npc
  • PermUtils
  • PluginAsyncTask
  • PluginCallbackTask
  • PMScript
  • QueryAsyncTask
  • Rcon
  • RconTask
  • Session
  • ShieldSession
  • ShoppingCart
  • SignUtils
  • SkinUtils
  • SpySession
  • SubCommandMap
  • TPUtils
  • Overview
  • Namespace
  • Class

Class mc

Simple translation class in the style of gettext.

You can actually use gettext tools to process these files. For example, to create/update a message catalogue use:

xgettext --no-wrap [-j] [-o file]

Where -j is used to join an existing catalague. -o file is the output file.

Basic usage:

  • mc::load("messages.po|messages.ini");
  • mc::plugin_init($plugin,$plugin->getFile());
  • mc::_("string to translate\n")
  • mc::_("string to translate %1% %2%\n",$arg1,$arg2)
  • mc::n(mc::_("singular form"),mc::_("Plural form"),$count)
Abstract
Namespace: aliuly\common
Located at aliuly/common/mc.php
Methods summary
public static str
# _( str[] $args )

Main translation function

Main translation function

This translates strings. The naming of "_" is to make it compatible with gettext utilities. The string can contain "%1%", "%2%, etc... These are inserted from the following arguments. Use "%%" to insert a single "%".

Parameters

$args
  • messages

Returns

str
translated string
public static str
# n( str $a, str $b, integer $c )

Plural and singular forms.

Plural and singular forms.

Parameters

$a
  • Singular form
$b
  • Plural form
$c
  • the number to test to select between $a or $b

Returns

str
  • Either plural or singular forms depending on the value of $c
public static integer|false
# plugin_init( Plugin $plugin, str $path )

Load a message file for a PocketMine plugin. Only uses .ini files.

Load a message file for a PocketMine plugin. Only uses .ini files.

Parameters

$plugin
  • owning plugin
$path
  • output of $plugin->getFile()

Returns

integer|false
  • false on error or the number of messages loaded
public static integer|false
# load( str $f )

Load the specified message catalogue. Can read .ini or .po files.

Load the specified message catalogue. Can read .ini or .po files.

Parameters

$f
  • Filename to load

Returns

integer|false
  • returns the number of strings loaded or false on error
Properties summary
public static str[] $txt

$txt Message translations

$txt Message translations

# []
API documentation generated by ApiGen