Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

howto display different foldernames or translate folder names? #1012

Closed
sweiguny opened this issue Apr 16, 2015 · 7 comments
Closed

howto display different foldernames or translate folder names? #1012

sweiguny opened this issue Apr 16, 2015 · 7 comments
Labels
Milestone

Comments

@sweiguny
Copy link

hi everybody.

i am working on a CMS which shall provide more than one language.
therefore i'd like to give the folders, that are managed by elfinder, a name that represents a key of my translation module (kind of array). based on that key, the translated name shall be displayed.

example:
folder structure on filesystem:

\home
    \images
        \users
    \files
        \invoices
    ...

if a user opens elfinder in english, it shall be like

\Home
    \Images
        \Users
    \Files
        \Invoices
    ...

if a user opens elfinder in german, it shall be like

\Start
    \Bilder
        \Benutzer
    \Dateien
        \Rechnungen
    ...

that means, the acutal folder name is replaced by the translation.
does anyone have an idea how to accomplish that?

br

@lovesia
Copy link

lovesia commented Apr 16, 2015

NAVER - http://www.naver.com/

lovesin83@naver.com 님께 보내신 메일 <[elFinder] howto display different foldernames or translate folder names? (#1012)> 이 다음과 같은 이유로 전송 실패했습니다.


받는 사람이 회원님의 메일을 수신차단 하였습니다.


@nao-pon
Copy link
Member

nao-pon commented Apr 16, 2015

@sweiguny How about Google web site translation. It was put on the demo site on probation. ;-)

@lovesia
Copy link

lovesia commented Apr 16, 2015

NAVER - http://www.naver.com/

lovesin83@naver.com 님께 보내신 메일 <Re: [elFinder] howto display different foldernames or translate folder names? (#1012)> 이 다음과 같은 이유로 전송 실패했습니다.


받는 사람이 회원님의 메일을 수신차단 하였습니다.


@sweiguny
Copy link
Author

@nao-pon This is not the way I imagine. I want to be independent from externals.
but thank you for your input.

now i found it :)
the golden part of the code is the protected function _basename.
i overrode the function in a class named elFinderVolumeMyLocalFileSystem and modified the driver key in the options:

$options = [
            "roots"  => [
                [
                    "driver"        => "MyLocalFileSystem",
                    "path"          => "/some/path/",

@nao-pon
Copy link
Member

nao-pon commented Apr 17, 2015

I see. That's something of great interest! 😆

@sweiguny
Copy link
Author

Hi,

well, i now came across the issue, that, if i am going to "open" a file with elfinder...

image

The opened path will be .../Intern/Avatare/IMG_1376.JPG which is, of course, not the real path.

in my getFileCallback i've implemented a function for "retranslating" the path for inserting files into e.g. tinymce.
is there somewhere the possibility to get the real path of the file on opening or quicklook?

@sweiguny sweiguny reopened this Aug 24, 2015
@lovesia
Copy link

lovesia commented Aug 24, 2015

NAVER - http://www.naver.com/

lovesin83@naver.com 님께 보내신 메일 <Re: [elFinder] howto display different foldernames or translate folder names? (#1012)> 이 다음과 같은 이유로 전송 실패했습니다.


받는 사람이 회원님의 메일을 수신차단 하였습니다.


@sweiguny
Copy link
Author

also when i want to display details the "wrong" path is displayed:

image

@sweiguny sweiguny reopened this Aug 24, 2015
@sweiguny
Copy link
Author

as i closed this issue accidentially the last time, i think, that it got perished 😄

is there somewhere the possibility to get the real path of the file on opening or quicklook?

im afraid that the only possibility is to implement such a translated path by myself.

@troex troex added the feature label May 4, 2016
@troex troex modified the milestone: 2.2 May 4, 2016
@nao-pon
Copy link
Member

nao-pon commented Jul 20, 2016

Quoted from the commit log

connector added an option i18nFolderName

// enable i18n folder name that convert name to elFinderInstance.messages['folder_'+name]
'i18nFolderName'  => false,

e.g. connector.php

$opts = array(
    'roots'  => array(
        array(
            'driver'         => 'LocalFileSystem',
            'path'           => '/path/to/files/',
            'i18nFolderName' => true,
        )
    )
);

// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();

e.g. elfinder.html

// Additional translation messages
var i18nFolderMsgs = {
    'en': {
        'folder_Downloads':   'Downloads',
        'folder_Images':      'Images',
        'folder_LargeVideos': 'Videos',
        'folder_MIME-types':  'MIME types',
        'folder_Welcome':     'Welcome(Multilingual)'
    },
    'jp': {
        'folder_Downloads':   'ダウンロード',
        'folder_Images':      '画像',
        'folder_LargeVideos': '動画',
        'folder_MIME-types':  'MIMEタイプ',
        'folder_Welcome':     'ようこそ(多言語)'
    }
};

var options = {
    url      : 'php/connector.php',
    handlers : {
        init : function(e, fm) {
            // Register additional messages
            $.extend(fm.messages, i18nFolderMsgs.en, i18nFolderMsgs[fm.lang] || {});
        }
    }
}

$('#elfinder').elfinder(options);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants