File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,21 +99,17 @@ protected function translate(string $string) : string
9999 $ slug = $ this ->limitString ($ slug );
100100
101101 $ cache = new Cache ();
102- $ lang = $ this ->getLanguage ();
103- $ key = $ cache ->generateKey ('i18n ' , false , [
104- 'lang ' => $ lang ,
105- 'length ' => $ length ,
106- 'slug ' => $ slug
107- ]);
108-
109- $ translation = $ cache ->get ($ key );
110- if ( !$ cache ->isCached () ) {
102+ $ lang = $ this ->getLanguage ();
103+ $ key = "i18n- {$ lang }- {$ length }- {$ slug }" ;
104+
105+ $ data = $ cache ->get ($ key , $ status );
106+ if ( !$ status ) {
111107 $ translator = new Translator ($ lang );
112- $ translation = $ translator ->translate ($ string );
113- $ cache ->set ($ translation , ' translation ' );
108+ $ data = $ translator ->translate ($ string );
109+ $ cache ->set ($ key , $ data , 0 );
114110 }
115111
116- return (string )$ translation ;
112+ return (string )$ data ;
117113 }
118114
119115 /**
Original file line number Diff line number Diff line change @@ -25,24 +25,27 @@ final class Core
2525 \FloatPHP \Helpers \Framework \inc \TraitSessionable;
2626
2727 /**
28+ * Init Core.
29+ *
2830 * @param array $config
2931 */
3032 public function __construct (array $ config = [])
3133 {
32- $ config = (new Installer ())->parse ($ config );
34+ $ config = (new Installer ())->default ($ config );
3335
34- // FloatPHP setup
36+ // Setup
3537 if ( $ config ['--disable-setup ' ] !== true ) {
3638 if ( !Installer::isInstalled () ) {
37- (new Installer ())->setup ();
39+ $ db = ($ config ['--disable-database ' ] === true ) ? false : true ;
40+ (new Installer ())->setup ($ db );
3841 }
3942 }
4043
41- // FloatPHP X-Powered-By header
44+ // X-Powered-By header
4245 if ( $ config ['--disable-powered-by ' ] !== true ) {
4346 header ('X-Powered-By:FloatPHP ' );
4447 }
45-
48+
4649 // Start session
4750 if ( $ config ['--disable-session ' ] !== true ) {
4851 $ this ->startSession ();
@@ -54,7 +57,7 @@ public function __construct(array $config = [])
5457 $ this ->throwError (503 );
5558 }
5659
57- // FloatPHP timezone
60+ // Timezone
5861 $ this ->setDefaultTimezone ($ config ['--default-timezone ' ]);
5962
6063 // Start routing
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public function __construct()
2424 {
2525 parent ::__construct ();
2626 }
27-
27+
2828 /**
2929 * Add object | Forced bind (Create).
3030 *
You can’t perform that action at this time.
0 commit comments