Multilanguage Library



( ZN >= 3.0.0 )

Multilingual use is required for many projects. The ZN Framework already has a Multi Language library with a more optional and practical use with the use of a lang () method. Below you will find out how you can manage languages ​​with this library.

 

# Methods


Bool insert ( String $ lang , $ key , String $ data = NULL )
String select ( String $ key , $ convert = NULL )
Bool update ( String $ lang , $ key , String $ data = NULL )
Bool delete ( String $ lang , $ key )
Bool deleteAll ( $ lang )
Bool lang ( String $ lang = 'tr' )
String table ( $ lang = NULL)
 

 

# Insert ( ZN> = 3.0.0 )


Used to add one or more words consisting of a key and a value pair to the specified language.

Parameters

String $ lang Language code. The language to which the word belongs will be specified. Generally, language abbreviations such as en, tr are used.
Mixed $ key It is the common key to be used to represent the words in all languages. It is usually advisable to use English words as keys.
String $ data = NULL The heel to be added to the file itself.
return Bool

Use of

ML::insert('en', 'example', 'Example');
ML::insert('en', ['example' => 'Example', 'application' => 'Application']); 
Generated File: Projects / ProjectDirectory / Storage / MultiLanguage / en.ml

 

# Select ( ZN >= 3.0.0 )


The values ​​of the generated key value pairs are reached using the keys. However, you need to be able to specify which calf you want to bring before you try to call a word. The ML :: lang () method is used for this. The use of this method is mentioned at the end of the page. We have tried to give an example on this example in terms of being connected to the line.

Parameters

String $ key The key that represents Kelimey.
return String

Use of

echo ML::select('example');
example

 

# Update ( ZN >= 3.0.0 )


It is used to update one or more words consisting of key and value pairs of the specified language. ML :: insert () has the same usage as the insert function. In other words, the insert () method can be preferred for the update operation .

Parameters

String $ lang Language code. The language in which the language is to be updated is specified. Generally, language abbreviations such as en, tr are used.
Mixed $ key It is the common key to be used to represent the words in all languages. It is usually advisable to use English words as keys.
String $ data = NULL The file itself is to be updated with the heel itself.
return Bool

Use of

ML::update('en', 'example', 'Example');
ML::update('en', ['example' => 'Example', 'application' => 'Application']);

 

# Delete ( ZN> = 3.0.0 )


Whichever words are deleted from the specified language, the keys representing that word are used. If more than one data item is to be deleted, the array parameter is specified.

Parameters

String $ lang The language in which the word belongs will be deleted. Usually used language truncations such as en, tr. 2 - string / array Keyword Key used when keyword is added.
Mixed $ key Key used when adding words.
return Bool

Use of

ML::delete('en', 'example');
ML::delete('en', ['example', 'application']);

 

# DeleteAll ( ZN >= 3.0.7 )


Used to delete all of the generated dictionaries or those specified as parameters.

Parameters

String $ lang The language in which the word belongs will be deleted.
return Bool

Use of

ML::deleteAll('tr');
ML::deleteAll(['tr', 'en']);
ML::deleteAll(); # All Files

 

# Lang ( ZN >= 3.0.0 )


The use of this method is like setLang () . If you want to use the language of the page, the name of that file is used.

Parameters

String $ lang The language in which the word belongs will be deleted.
return Bool

Use of

ML::lang('tr');

 

# Table ( ZN >= 4.0.0 )


It is a data table used to manage your language files through a table. This table makes it much easier to add, edit and delete words. Settings for table design can be made in Config / EncodingSupport.php file.

Note: The settings for this table ( ZN OE ) are located in the Config / ViewObjects.php file in the distribution .

Parameters

Mixed $ lang Tongues to be shown in the table. If not specified, all languages ​​will appear.
return String

Use of

echo ML::table();
echo ML::table(['en', 'tr']); 
echo ML::limit(100)->table(); # Page Total Rows
echo ML::url('home/table')->limit(20)->table(); # Pagination -> URL