File Language Library



It is a library designed to build a file-based multi-language structure. ZN Framework itself uses this library. Common language files for internal or all projectsExternal / Languages ​​/. Pre-defined Turkish and English language files are available. To create custom language files for the project involved in the projectlanguages ​​/directory. If you plan to use the same language files in your other projectsExternal / Languages ​​/ directory.

 

# Methods


Bool set ( String $ l = NULL )
String get ( Void)
String current ( )Void
String select ( String $ file = NULL , String $ str = NULL , Mixed $ changed = NULL )

 

# Set ( ZN >= 5.0.0 )


Used to set the language content of the site. The default value of the parameter is tr , that is, Turkish. Two language settings are available by default on the system. These; en and en 'is. To change these settings, you need to make the necessary settings in the Config/Project.php file.

Parameters

String $ lang = NULL Language Abbreviation
return Bool

Use of

echo Lang::get();

Lang::set('tr');

echo Lang::get();
en
tr

 

# Get ( ZN> = 5.0.0 )


Used to learn the site's set language. There are two ways to do this. The first is the Lang :: get () function, and the other is the Lang :: current () function. ButLang :: current () use may result depending on a number of circumstances.

Parameters

void
return String

Use of

echo Lang::get();     

Lang::set('tr');

echo Lang::get();
en
tr

 

# Current ( ZN >= 5.0.0 )


Used to learn the active language. However, the setting truemust be set to the active language option . Usage is similar to Lang :: get () . Essentially, the work they did is the same, but there is a difference between them . The difference is that Lang :: current () method can be usedConfig / Services.php in the file uri: lang = false value truemust be set to.

Parameters

void
return String

Use of

echo Lang::current();
most
Note: If this setting is set to false , the Lang :: current () method returns false .

 

# Select ( ZN >= 0.0.1 )


This method is used to use language files that are defined in the system or that you will create.

Parameters

String $ file The name of the configuration file.
String $ key = NULL The name of the setting.
Mixed $ replace = NULL The values ​​to change.
return Mixed

Use of

echo Lang::select('Database', 'parameterError');       
echo Lang::select('Database', 'parameterError', 'TEST');
echo Lang::select('Database', 'parameterError', ['%' => 'TEST']);
% parameter is missing or empty!
TEST parameter is missing or empty!
TEST parameter is missing or empty!

Magic Call

You can also use the name of the language file to be called as the method name. 

echo Lang::database('parameterError');
echo Lang::database('parameterError', 'TEST');
% parameter is missing or empty!
TEST parameter is missing or empty!