PHP 클래스 Themsaid\Langman\Manager

파일 보기 프로젝트 열기: themsaid/laravel-langman 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( Illuminate\Filesystem\Filesystem $disk, string $path, array $syncPaths ) Manager constructor.
collectFromFiles ( ) : array Collect all translation keys from views files.
createFile ( $fileName ) : void Create a file for all languages if does not exist already.
files ( ) : array Array of language files grouped by file name.
fillKeys ( string $fileName, array $keys ) : void Fills translation lines for given keys in different languages.
getAllViewFilesWithTranslations ( ) : array Get found translation lines found per file.
getFileContent ( string $filePath, boolean $createIfNotExists = false ) : array Get the content in the given file path.
getKeysExistingInALanguageButNotTheOther ( $values ) : array Extract keys that exists in a language but not the other.
languages ( ) : array Array of supported languages.
removeKey ( string $fileName, string $key ) : void Remove a key from all language files.
setPathToVendorPackage ( string $packageName ) : void Sets the path to a vendor package translation files.
writeFile ( string $filePath, array $translations ) : void Write a language file from array.

비공개 메소드들

메소드 설명
neglectVendorFiles ( $filesByFile ) : array Nelgect all vendor files.
stringLineMaker ( $array, $prepend = '' ) : string Write the lines of the inner array of the language file.

메소드 상세

__construct() 공개 메소드

Manager constructor.
public __construct ( Illuminate\Filesystem\Filesystem $disk, string $path, array $syncPaths )
$disk Illuminate\Filesystem\Filesystem
$path string
$syncPaths array

collectFromFiles() 공개 메소드

e.g. ['users' => ['city', 'name', 'phone']]
public collectFromFiles ( ) : array
리턴 array

createFile() 공개 메소드

Create a file for all languages if does not exist already.
public createFile ( $fileName ) : void
$fileName
리턴 void

files() 공개 메소드

ex: ['user' => ['en' => 'user.php', 'nl' => 'user.php']]
public files ( ) : array
리턴 array

fillKeys() 공개 메소드

ex. for $keys = ['name' => ['en' => 'name', 'nl' => 'naam']
public fillKeys ( string $fileName, array $keys ) : void
$fileName string
$keys array
리턴 void

getAllViewFilesWithTranslations() 공개 메소드

e.g. ['users.blade.php' => ['users.name'], 'users/index.blade.php' => ['users.phone', 'users.city']]

getFileContent() 공개 메소드

Get the content in the given file path.
public getFileContent ( string $filePath, boolean $createIfNotExists = false ) : array
$filePath string
$createIfNotExists boolean
리턴 array

getKeysExistingInALanguageButNotTheOther() 공개 메소드

Given a dot array of all keys in the format 'file.language.key', this method searches for keys that exist in one language but not the other and outputs an array consists of those keys.
public getKeysExistingInALanguageButNotTheOther ( $values ) : array
$values
리턴 array

languages() 공개 메소드

ex: ['en', 'sp']
public languages ( ) : array
리턴 array

removeKey() 공개 메소드

Remove a key from all language files.
public removeKey ( string $fileName, string $key ) : void
$fileName string
$key string
리턴 void

setPathToVendorPackage() 공개 메소드

Sets the path to a vendor package translation files.
public setPathToVendorPackage ( string $packageName ) : void
$packageName string
리턴 void

writeFile() 공개 메소드

Write a language file from array.
public writeFile ( string $filePath, array $translations ) : void
$filePath string
$translations array
리턴 void