CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • MoFileParser
  • PoFileParser

Class PoFileParser

Parses file in PO format

Namespace: Cake\I18n\Parser
Copyright: Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/)
Copyright: Copyright (c) 2012, Clemens Tolboom
Copyright: Copyright (c) 2014, Fabien Potencier https://github.com/symfony/Translation/blob/master/LICENSE
Location: I18n/Parser/PoFileParser.php

Method Summary

  • _addMessage() protected
    Saves a translation item to the messages.
  • parse() public
    Parses portable object (PO) format.

Method Detail

_addMessage() protected ¶

_addMessage( array $messages , array $item )

Saves a translation item to the messages.

Parameters
array $messages
The messages array being collected from the file
array $item
The current item being inspected

parse() public ¶

parse( string $resource )

Parses portable object (PO) format.

From https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files we should be able to parse files having:

white-space

translator-comments

. extracted-comments

: reference...

, flag...

| msgid previous-untranslated-string

msgid untranslated-string msgstr translated-string

extra or different lines are:

| msgctxt previous-context

| msgid previous-untranslated-string

msgctxt context

| msgid previous-untranslated-string-singular

| msgid_plural previous-untranslated-string-plural

msgid untranslated-string-singular msgid_plural untranslated-string-plural msgstr[0] translated-string-case-0 ... msgstr[N] translated-string-case-n

The definition states: - white-space and comments are optional. - msgid "" that an empty singleline defines a header.

This parser sacrifices some features of the reference implementation the differences to that implementation are as follows. - Translator and extracted comments are treated as being the same type. - Message IDs are allowed to have other encodings as just US-ASCII.

Items with an empty id are ignored.

Parameters
string $resource
The file name to parse
Returns
array
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs