Skip to content

Commit

Permalink
Cleaned and fixed a couple of things
Browse files Browse the repository at this point in the history
  • Loading branch information
BoondoggleLabs committed Aug 4, 2017
1 parent bb8c6a3 commit 9c9684f
Show file tree
Hide file tree
Showing 180 changed files with 638 additions and 3,851 deletions.
8 changes: 8 additions & 0 deletions .idea/Android-Translator.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

397 changes: 397 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ Add comments to any string.
##### Exporting as XML
Once the user clicks submit on the last page, the xml will be created and emailed to the address coded in submit.php

### Set up instructions
1. Delete everything in /xml/ and replace with your own string resource files.
2. Edit index.php changing the app name to your own, the email address and any text you wish to edit.
3. Edit submit.php to configure PHPMailer to work with your server, and to send to your own email address.

### Contributing
Feel free to refactor this and clean it up! Any commits welcome.
35 changes: 9 additions & 26 deletions getStrings.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function getNeatFileName($filename){
return ucfirst($filename);
}

function find_by_name($resources, $name){
function find_node_by_name($resources, $name){
foreach($resources as $resNode) {
if ($resNode['name'] == $name)
return $resNode;
Expand All @@ -35,20 +35,21 @@ function get_file_as_id($file){

$resources_dir = 'xml/';
$default_lang = $resources_dir.'values/';
$default_lang_strings = scandir($default_lang);
$default_lang_strings = array_splice($default_lang_strings, 2); // remove . and ..
$default_lang_string_files = scandir($default_lang);
$default_lang_string_files = array_splice($default_lang_string_files, 2); // remove . and ..
$translations_directorys = scandir($resources_dir);
$translations_directorys = array_splice($translations_directorys, 3); // remove . and .. and values/

$comments = [];

foreach($default_lang_strings as $file) {
foreach($default_lang_string_files as $file) {
$resources[$file]['default'] =
new SimpleXMLElement(
file_get_contents($default_lang.$file)
);

$comments = array_merge($comments, get_comments(file_get_contents($default_lang.$file)));

// Delete untranslatable strings
error_reporting(E_ERROR | E_PARSE);
foreach ($resources[$file]['default']->children() as $string) {
Expand All @@ -59,35 +60,17 @@ function get_file_as_id($file){
}

foreach($translations_directorys as $directory) {
foreach($resources as $key => $resource){
$file_address = $resources_dir.$directory."/".$key;
foreach($resources as $file => $resource){
$file_address = $resources_dir.$directory."/".$file;
if (file_exists($file_address)){
$lang = str_replace("values-", "", $directory);
$resources[$key][$lang] =
$resources[$file][$lang] =
simplexml_load_string(
file_get_contents($file_address)
);/* $resources[$key][$lang] =
new SimpleXMLElement(
file_get_contents($file_address)
);*/
);
}
}
}

//echo Locale::getDisplayLanguage($key, "en")
//print_r($resources);


//echo find_by_name($resources["error_strings.xml"]['default'], 'connection_suspended_error')


//$strings = $strings->resources;

/*foreach ($strings as $string) {
print_r($string);
echo $string;
echo $string['name'];
}*/


?>
Loading

0 comments on commit 9c9684f

Please sign in to comment.