I need to parse this language in PHP, but I don't know what language it is and how to parse it.
Does someone know what language it is?
And if it's not a language, can someone explain me how to parse it?
Thank you very much
include "folder/file1.conf"
include "folder/file2.conf"
auth-mocked {
welcome = "Welcome"
login = "Login to continue:"
placeholder = "login"
button = "Login"
error = "Error:"
}
auth {
sso {
validation {
expected-uuid = "You need an UID"
}
session-not-found = "session was not found"
}
}
header {
company-name = "Company name"
help-popup {
title = "Need help?"
paragraph = "If you have any issue, you can contact your dedicated interlocutor:"
}
language-popup {
title = "Change language"
}
language = "Change language"
profile = "My profile"
terms-of-use = "Terms of use"
ao-documents = "Documents"
logout = "Logout"
user = "User"
}
black-panel {
common {
form = "You are currently filling the form:"
btn-i-understand = "Ok, thanks"
btn-link-view = "View"
}
}
I have finaly created my own parser to get the label for each keys.
function parseFile($file){
$title = "";
$key = "";
$value = "";
$str = "";
$array = array();
$results = array();
$lines = file('./generated_json/'.$file);
foreach($lines as $line){
if(strpos($line, " {
")){
$title = str_replace(" {", "", $line);
array_push($array, $title);
$str = implode(".", $array);
}
if(strpos($line, "=")){
$keyEx = explode("=", $line);
$key = $keyEx[0];
$value = $keyEx[1];
$parsed = $str.".".$key;
$parsed = preg_replace('/\s+/', '', $parsed);
$parsed = str_replace("=", "", $parsed);
array_push($results, $parsed." = ".$value);
}
if(strpos($line, "}
")){
array_pop($array);
$str = implode(".", $array);
}
}
return $results;
}
It may be an homemade file format, but here is a list of common file formats used for translation : http://docs.translatehouse.org/projects/translate-toolkit/en/latest/formats/
If you don't find your file format in there, you could probably write a parser for it.