jamespot-react-core 1.1.202 → 1.1.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jamespot-react-core",
3
- "version": "1.1.202",
3
+ "version": "1.1.205",
4
4
  "description": "Jamespot React Core",
5
5
  "main": "./build/app.bundle.js",
6
6
  "types": "./build/src/App.d.ts",
@@ -56,9 +56,9 @@
56
56
  "eslint-import-resolver-typescript": "^3.6.3",
57
57
  "eslint-plugin-import": "^2.31.0",
58
58
  "history": "^5.3.0",
59
- "jamespot-front-business": "^1.1.100",
60
- "jamespot-react-components": "^1.0.256",
61
- "jamespot-user-api": "^1.0.227",
59
+ "jamespot-front-business": "^1.1.103",
60
+ "jamespot-react-components": "^1.0.259",
61
+ "jamespot-user-api": "^1.0.230",
62
62
  "marked": "^15.0.3",
63
63
  "react": "^17.0.2",
64
64
  "react-dom": "17.0.2",
@@ -35,20 +35,26 @@ class Translator
35
35
  {
36
36
  $this->translateResource(self::COMPONENT_RESOURCE_PATH);
37
37
  $this->translateResource(self::CORE_RESOURCE_PATH);
38
+ $error = false;
38
39
  foreach ([self::EXTENSION_RESOURCE_PATH, self::EXTENSION_RESOURCE_PATH_SUB] as $path) {
39
40
  foreach (glob($path) as $file) {
40
- $this->translateResource($file);
41
+ $res = $this->translateResource($file);
42
+ $error = $res ? true : $error;
41
43
  }
42
44
  }
45
+ if ($error) {
46
+ exit(2);
47
+ }
43
48
  }
44
49
 
45
50
  function translateResource($file)
46
51
  {
52
+ $error = false;
47
53
  $json = json_decode(file_get_contents($file), false);
48
- $json = $json->en;
54
+ $resourcesEN = array_keys((array)$json->en);
49
55
  $outputAllTranslations = [];
50
56
  foreach (self::LANGUAGES as $language) {
51
- echo "\n- translating file $file for language $language";
57
+ // echo "\n- translating file $file for language $language";
52
58
  $output = [];
53
59
  $this->traductionKeysTmp = $this->traductionKeys[$language];
54
60
  /*
@@ -57,7 +63,7 @@ class Translator
57
63
  * - either take it from jameslation in english
58
64
  * - or from the default extension english value
59
65
  */
60
- foreach ($json as $key => $value) {
66
+ foreach ($resourcesEN as $key) {
61
67
  if (array_key_exists($key, $this->traductionKeysTmp)) {
62
68
  $output[$key] = $this->traductionKeysTmp[$key];
63
69
  continue;
@@ -65,13 +71,15 @@ class Translator
65
71
  $output[$key] = $this->traductionKeys["en"][$key];
66
72
  continue;
67
73
  }
68
- if (in_array($language, ['en', 'fr', 'es'])) {
74
+ if ($language === 'en') {
69
75
  echo "\nKey not found: $key";
76
+ $error = true;
70
77
  }
71
78
  }
72
79
  $outputAllTranslations[$language] = $output;
73
80
  }
74
81
  file_put_contents($file, json_encode($outputAllTranslations, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
82
+ return $error;
75
83
  }
76
84
  }
77
85