Overview

Namespaces

  • Kotchasan
    • Cache
    • Database
    • Http
    • Log
    • Orm
  • None
  • PDF
  • PHP
  • Psr
    • Cache
    • Http
      • Message
    • Log

Classes

  • Accordion
  • ArrayTool
  • CKEditor
  • Collection
  • Config
  • Controller
  • Country
  • Csv
  • Curl
  • Currency
  • Database
  • DataTable
  • Date
  • DOMNode
  • DOMParser
  • Email
  • File
  • Files
  • Form
  • Grid
  • Html
  • Htmldoc
  • HtmlTable
  • Image
  • InputItem
  • Inputs
  • KBase
  • Language
  • ListItem
  • Login
  • Menu
  • Mime
  • Model
  • Number
  • Object
  • Password
  • Pdf
  • Province
  • Router
  • Singleton
  • Tab
  • TableRow
  • Template
  • Text
  • Validator
  • View
  • Overview
  • Namespace
  • Class
  • Tree

Class Language

Class สำหรับการโหลด config.

Kotchasan\KBase
Extended by Kotchasan\Language
Final
Namespace: Kotchasan
Author: Goragod Wiriya admin@goragod.com
Since: 1.0
Located at Kotchasan/Language.php
Methods summary
public static
# find( string $key, mixed $default = null, mixed $value_key = null )

ค้นหาข้อความภาษาที่ต้องการ ถ้าไม่พบคืนค่า $default ถ้าไม่ระบุ $default (null) คืนค่า $key ถ้าระบุ $value_key มาด้วยและ ค่าของภาษาเป็นแอเรย์ จะคืนค่า แอเรย์ของภาษาที่ $value_key ถ้าไม่พบข้อมูลที่เลือกคืนค่า null.

ค้นหาข้อความภาษาที่ต้องการ ถ้าไม่พบคืนค่า $default ถ้าไม่ระบุ $default (null) คืนค่า $key ถ้าระบุ $value_key มาด้วยและ ค่าของภาษาเป็นแอเรย์ จะคืนค่า แอเรย์ของภาษาที่ $value_key ถ้าไม่พบข้อมูลที่เลือกคืนค่า null.

Parameters

$key
$default
$value_key

Assert

('XYZ', array()) [==] array()
('YEAR_OFFSET') [==] 543
('DATE_LONG', null, 0) [==] 'อาทิตย์'
('not found', 'default') [==] 'default'
public static mixed
# get( string $key, mixed $default = null )

ฟังก์ชั่นอ่านภาษาที่ ถ้าไม่พบ $key ที่ต้อง $default = null (หรือไม่ระบุ) คืนค่า $key $default = อื่นๆ คืนค่า $default

ฟังก์ชั่นอ่านภาษาที่ ถ้าไม่พบ $key ที่ต้อง $default = null (หรือไม่ระบุ) คืนค่า $key $default = อื่นๆ คืนค่า $default

Parameters

$key
ข้อความในภาษาอังกฤษ หรือ คีย์ของภาษา
$default
ถ้าไม่ระบุ (null) และไม่พบ $key

Returns

mixed

Assert

('YEAR_OFFSET') [==] 543
('XYZ', array()) [==] array()
public static array
# getItems( array $keys = array() )

อ่านภาษาหลายรายการ ตามที่กำหนดโดย $keys.

อ่านภาษาหลายรายการ ตามที่กำหนดโดย $keys.

Parameters

$keys

Returns

array
public static array
# installed( string $type )

โหลดไฟล์ภาษาทั้งหมดที่ติดตั้ง คืนค่าข้อมูลภาษาทั้งหมด.

โหลดไฟล์ภาษาทั้งหมดที่ติดตั้ง คืนค่าข้อมูลภาษาทั้งหมด.

Parameters

$type

Returns

array
public static array
# installedLanguage( )

รายชื่อภาษาที่ติดตั้ง.

รายชื่อภาษาที่ติดตั้ง.

Returns

array
public static integer
# keyExists( array $languages, string $key )

ตรวจสอบคีย์ของภาษาซ้ำ คืนค่าลำดับที่พบ (รายการแรกคือ 0), คืนค่า -1 ถ้าไม่พบ.

ตรวจสอบคีย์ของภาษาซ้ำ คืนค่าลำดับที่พบ (รายการแรกคือ 0), คืนค่า -1 ถ้าไม่พบ.

Parameters

$languages
ข้อมูลภาษาที่ต้องการตรวจสอบ
$key
รายการที่ต้องการตรวจสอบ

Returns

integer

Assert

(array(array('id' => 0, 'key' => 'One'), array('id' => 100, 'key' => 'Two')), 'One') [==] 0
(array(array('id' => 0, 'key' => 'One'), array('id' => 100, 'key' => 'Two')), 'two') [==] 100
(array(array('id' => 0, 'key' => 'One'), array('id' => 100, 'key' => 'Two')), 'O') [==] -1
public static string
# languageFolder( )

ฟังก์ชั่นอ่านชื่อโฟลเดอร์เก็บไฟล์ภาษา.

ฟังก์ชั่นอ่านชื่อโฟลเดอร์เก็บไฟล์ภาษา.

Returns

string
public static string
# name( )

อ่านชื่อภาษาที่กำลังใช้งานอยู่.

อ่านชื่อภาษาที่กำลังใช้งานอยู่.

Returns

string

Assert

() [==] 'th'
public static string
# setName( string $language )

กำหนดภาษาที่ต้องการ

กำหนดภาษาที่ต้องการ

Parameters

$language

Returns

string
public static string
# parse( array $match )

ฟังก์ชั่นแปลภาษาที่รับค่ามาจากการ parse Theme.

ฟังก์ชั่นแปลภาษาที่รับค่ามาจากการ parse Theme.

Parameters

$match
ตัวแปรรับค่ามาจากการ parse Theme

Returns

string

Assert

(array(1 => 'not found')) [==] 'not found'
public static mixed
# replace( string $key, array $replace )

ฟังก์ชั่นอ่านภาษา.

ฟังก์ชั่นอ่านภาษา.

Parameters

$key
ข้อความในภาษาอังกฤษ หรือ คีย์ของภาษา
$replace
ข้อความที่จะนำมาแทนที่เช่น array(':key' => 'value', ':key' => 'value')

Returns

mixed

Assert

('You want to :action', array(':action' => 'delete')) [==] 'You want to delete'
public static string
# save( array $languages, string $type )

บันทึกไฟล์ภาษา.

บันทึกไฟล์ภาษา.

Parameters

$languages
$type

Returns

string
public static string
# trans( string $content )

แปลภาษา.

แปลภาษา.

Parameters

$content

Returns

string

Assert

('ภาษา {LNG_DATE_FORMAT} ไทย') [==] 'ภาษา d M Y เวลา H:i น. ไทย'
Properties inherited from Kotchasan\KBase
$cfg, $request
kotchasan API documentation generated by ApiGen