0
The idea is to translate a system into PHP, where each ARRAY key is a translation.
Manually I have already managed to remove all keys and translate them, separate each translated key in a row, placing all in a text file.txt, now I want to put these already translated lines inside the ARRAY as VALUE, automatically pulling from the text file.txt
Ex:
<?php
$lang["CHAVE"] ="VALOR";
?>
Part of the code is this:
<?php
$lang["Signup"] ="";
$lang["Sign In"] ="";
$lang['Login Successful'] ='';
?>
It has to stay that way:
<?php
$lang["Signup"] ="Inscrição";
$lang["Sign In"] ="Entrar";
$lang['Login Successful'] ="Login com êxito";
?:>
This file has more than 2600 lines, all in this pattern, so I want to automate this work, has more files like this to do.
I noticed that there are still many PHP scripts that use this form of translation, it would be interesting to build a script to do this automated work.
Text file.txt
Inscrição
Entrar
Login com êxito
What is the format of the TXT file? You can put the first lines so we know how the data is in it.
– Everton da Rosa
Plain text only, one sentence per line.
– Paolo Henrik
And how will it be possible to associate each row with a corresponding key in the array? If the line format was something like KEY=translated text, it would be possible. However, it seems that there is only the translated text. How do we know if a line belongs to the Signup key or if it belongs to Sign in, for example?
– Everton da Rosa
The idea and each line correspond to a key in sequential order EX: First record of the ARRAY $lang["Signup"] ="Inscription"; 1 line of the TXT file -> Inscription
– Paolo Henrik