XH 1.6: 2lang installation
XH 1.6: 2lang installation
Installation went without problem. But I can't create the additional language files. Following the hints, nothing happens. No language menu is visible.
The structure is:
root/content/de vith an empty .2lang file added
The structure is:
root/content/de vith an empty .2lang file added
Last edited by cmb on Tue Sep 24, 2013 9:19 pm, edited 1 time in total.
Reason: moved from http://cmsimpleforum.com/viewtopic.php?f=2&t=6612
Reason: moved from http://cmsimpleforum.com/viewtopic.php?f=2&t=6612
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: CMSimple_XH 1.6 BETA
Hi Tata,Tata wrote:But I can't create the additional language files.
you need the following structure:
- root
-- de
---- .2lag
---- index.php
AND
- root
-- content
--- de
----- .htaccess
----- content.htm
Maybe the default download for the beta versions should come with a additional language installed?
At this point I'd like to suggest that it might be usefull when the core creates the 2lang-contenfolder with a default content.htm every time when a second language gets installed.
So the user must only copy one folder as it was before.
KR
Holger
Re: CMSimple_XH 1.6 BETA
+1Holger wrote:Maybe the default download for the beta versions should come with a additional language installed?
Re: CMSimple_XH 1.6 BETA
Well, now it works. I have not fully understand the steps.
I would also suggest to have one more language pre-installed (de?), or simply assigned as 2lang both in root and in the content folder witih a note in README that any additional langiage shall be installed due copying and renaming any 2lang folders both in root and content folder.
The structure then would be (maybe even):
root/
root/2lang-copy-rename/
root/2lang-copy-rename/content/
root/2lang-copy-rename/content/.htaccess
root/2lang-copy-rename/content/content.htm
root/2lang-copy-rename/.2lang
root/2lang-copy-rename/index.php
...
root/content/
root/content/2lang-copy-rename/
root/content/2lang-copy-rename/content/
root/content/2lang-copy-rename/content/.htaccess
root/content/2lang-copy-rename/content/content.htm
root/content/2lang-copy-rename/.2lang
root/content/2lang-copy-rename/index.php
...
root/content/.htaccess
root/content/index.php
Or let it be created automaticaly from admin backend in configuration as an optional feature with a text field:
Create 2lang [put in 2lang code] [OK]
I would also suggest to have one more language pre-installed (de?), or simply assigned as 2lang both in root and in the content folder witih a note in README that any additional langiage shall be installed due copying and renaming any 2lang folders both in root and content folder.
The structure then would be (maybe even):
root/
root/2lang-copy-rename/
root/2lang-copy-rename/content/
root/2lang-copy-rename/content/.htaccess
root/2lang-copy-rename/content/content.htm
root/2lang-copy-rename/.2lang
root/2lang-copy-rename/index.php
...
root/content/
root/content/2lang-copy-rename/
root/content/2lang-copy-rename/content/
root/content/2lang-copy-rename/content/.htaccess
root/content/2lang-copy-rename/content/content.htm
root/content/2lang-copy-rename/.2lang
root/content/2lang-copy-rename/index.php
...
root/content/.htaccess
root/content/index.php
Or let it be created automaticaly from admin backend in configuration as an optional feature with a text field:
Create 2lang [put in 2lang code] [OK]
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: CMSimple_XH 1.6 BETA
I'll try to explain. The following is the folder structure as delivered:Tata wrote:I have not fully understand the steps.
Code: Select all
2lang/
\_content/
| \_.htaccess
| \_content.htm
\_.2lang
\_index.php
content/
\_.htaccess
\_content.htm
Code: Select all
2lang/
\_content/
| \_.htaccess
| \_content.htm
\_.2lang
\_index.php
content/
\_.htaccess
\_content.htm
fr/
\_content/
| \_.htaccess
| \_content.htm
\_.2lang
\_index.php
Code: Select all
2lang/
\_content/
| \_.htaccess
| \_content.htm
\_.2lang
\_index.php
content/
\_fr/
| \_.htaccess
| \_content.htm
\_.htaccess
\_content.htm
fr/
\_.2lang
\_index.php
Code: Select all
function rfc()
{
global $c, $cl, $h, $u, $l, $su, $s, $tx, $e, $pth, $pd_router;
$contents = XH_readContents();
if ($contents === false) {
e('missing', 'content', $pth['file']['content']);
$contents = array(
array(), array(), array(), array(), array(),
new XH_PageDataRouter(array(), array(), array(), array())
);
}
list($u, $tooLong, $h, $l, $c, $pd_router) = array_values($contents);
$duplicate = 0;
$cl = count($c);
$s = -1;
if ($cl == 0) {
$c[] = '<h1>' . $tx['toc']['newpage'] . '</h1>';
$h[] = trim(strip_tags($tx['toc']['newpage']));
$u[] = uenc($h[0]);
$l[] = 1;
if ($su == $u[0]) {
$s = 0;
}
$cl = 1;
$pd_router->new_page();
return;
}
foreach ($tooLong as $i => $tl) {
if (XH_ADM && $tl) {
$e .= '<li><b>' . $tx['uri']['toolong'] . '</b>' . tag('br')
. '<a href="?' . $u[$i] . '">' . $h[$i] . '</a>' . '</li>';
}
}
foreach ($u as $i => $url) {
if ($su == $u[$i] || $su == urlencode($u[$i])) {
$s = $i;
} // get index of selected page
for ($j = $i + 1; $j < $cl; $j++) { //check for duplicate "urls"
if ($u[$j] == $u[$i]) {
$duplicate++;
$h[$j] = $tx['toc']['dupl'] . ' ' . $duplicate;
$u[$j] = uenc($h[$j]);
}
}
}
}
Maybe--I'm not sure. That might as well confuse users.Holger wrote:Maybe the default download for the beta versions should come with a additional language installed?
Christoph M. Becker – Plugins for CMSimple_XH
Re: CMSimple_XH 1.6 BETA
Ok, seems to work. But it does not create the new folder. So saving the empty/new page is still impossible.cmb wrote:To test it replace function rfc() in cmsimple/functions.php:
Re: CMSimple_XH 1.6 BETA
You're right. One has to find out how to get rid of the unused language..cmb wrote:Holger wrote:
Maybe the default download for the beta versions should come with a additional language installed?
Maybe--I'm not sure. That might as well confuse users.
IMO the best should be a semi-automatic solution.
Holger
Re: CMSimple_XH 1.6 BETA
Yes, that would be nice! I spent an hour looking for how to create a second languageHolger wrote:IMO the best should be a semi-automatic solution.
Josef
Nobody knows how much time he has left ...
http://oldnema.compsys.cz/en/?Demo_templates
http://oldnema.compsys.cz/en/?Demo_templates
Re: CMSimple_XH 1.6 BETA
To remember the procedure I have prepared the installation packet like this. So I understand, what there's do do if needing a 2lang. And here I can imagine that there would be the 2lang/content.htm accessible in backend and saveable under new name (e.g. de.htm) and a function would in this case:
1. create root/de with /content and all necessary files
2. create root/content/de with all necessary files
3. save the edited content into both root/de/content and root/de/content
So maybe one more item under Settings would be fine 2lang setting with:
Insert the code of desired 2lang (files and directories will be created on submit):
[ ? ? ] [ OK ] [ + ] [ - ]
[ ? ? ] [ OK ] [ + ] [ - ]
[ ? ? ] [ OK ] [ + ] [ - ]
[ Submit ]
1. create root/de with /content and all necessary files
2. create root/content/de with all necessary files
3. save the edited content into both root/de/content and root/de/content
So maybe one more item under Settings would be fine 2lang setting with:
Insert the code of desired 2lang (files and directories will be created on submit):
[ ? ? ] [ OK ] [ + ] [ - ]
[ ? ? ] [ OK ] [ + ] [ - ]
[ ? ? ] [ OK ] [ + ] [ - ]
[ Submit ]
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: CMSimple_XH 1.6 BETA
I'm not sure if the possibility to create a second language from the back-end is the best option. One one hand this could easily fail due to file system permissions; usually I wouldn't set the root folder writable, so creating root/de/ will fail. On the other hand it might obscure where the files are actually stored, and it won't help when upgrading from an earlier CMSimple(_XH) version.
Another alternative based on the modification of rfc() (which I suggested earlier), would be to create the content/LANG/ folder in XH_saveContents() if it doesn't exist. For testing replace XH_saveContents() in cmsimple/functions.php with the following (and replace rfc() with the alternative above):
So let's assume the user has copied and renamed 2lang/ as usual. In the back-end he is presented a single empty page ("New Page") and a warning that the content file is missing. Nevertheless he is able to edit this page and save it (the folder and the content.htm will be created). If that doesn't work due to permissions, he gets the warning:
Another alternative based on the modification of rfc() (which I suggested earlier), would be to create the content/LANG/ folder in XH_saveContents() if it doesn't exist. For testing replace XH_saveContents() in cmsimple/functions.php with the following (and replace rfc() with the alternative above):
Code: Select all
function XH_saveContents()
{
global $c, $pth, $cf, $tx, $pd_router;
$hot = '<h[1-' . $cf['menu']['levels'] . '][^>]*>';
$hct = '<\/h[1-' . $cf['menu']['levels'] . ']>';
$title = utf8_ucfirst($tx['filetype']['content']);
$cnts = "<html><head><title>$title</title>\n"
. $pd_router->headAsPHP()
. '</head><body>' . "\n";
foreach ($c as $j => $i) {
preg_match("/(.*?)($hot(.+?)$hct)(.*)/isu", $i, $matches);
$page = $matches[1] . $matches[2] . PHP_EOL . $pd_router->pageAsPHP($j)
. $matches[4];
$cnts .= rmnl($page . "\n");
}
$cnts .= '</body></html>';
if (!file_exists($pth['folder']['content'])) {
mkdir($pth['folder']['content'], true);
}
return XH_writeFile($pth['file']['content'], $cnts) !== false;
}
IMO far from perfect, but not too bad either. At least the user sees the file path to the expected content.htm and is able to create it himself.Nicht schreibbar Content-Datei
../content/de/content.htm
Last edited by cmb on Sun Oct 13, 2013 12:21 pm, edited 1 time in total.
Reason: fixed link
Reason: fixed link
Christoph M. Becker – Plugins for CMSimple_XH