Perhaps I’m just not fully understanding the documentation right now but is there a way to set a unique identifier so my cached translations are not being overwritten?
Each domain has the same namespace.
Here is what I have so far in my module.config.php
'translator' => array(
'locale' => 'en',
'translation_file_patterns' => array(
array(
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
'text_domain' => 'ftp'
)
),
'cache' => \Zend\Cache\StorageFactory::factory(array(
'adapter' => 'apc',
'plugins' => array(
'exception_handler' => array(
'throw_exceptions' => false
)
)
))
)
Now I have two Apache VirtualHosts running on the same machine and in each VirtualHost I have a module named Ftp and each of those modules uses the ftp text_domain to translate their own translations.
Let’s say I have a translation key named translate_this_text which is used on both domains.
On domain1.com it would read, Test1
on domain2.com it would read, Test2
If I access domain1.com the text is translated to Test1
If I access domain2.com the text is translated to Test1, but this should be Test2
If I clear the APC Cache and access domain2.com then the translation shows Test2 but then if I access domain1.com it shows Test2.
I hope that wasn’t too confusing.
So in the end, is there a way to set some type of unique identifier on each host so they don’t overwrite each other since they exist on the same machine right now?
Replace the
adaptervalue by an array so you can inject options into the APC adapter:I would write above config without
namespacekey in your global file and then yourconfig.local.phpyou add this rule:For every application you can simply edit your local config file and have the global cache options shared.