kopano-localize-folders

Hello.

I just tried the new kopano-localize-folders command.
First i created a test-user with german locales.

Then i changed his store to english without any problems.
After that i wanted to change back to german an got a traceback:

root@srv:~# kopano-localize-folders -u user --lang en_GB.UTF-8 --verbose
user
user: Changing localized folder names to "en_GB.UTF-8"
Running in verbose mode
Changing MAPI "junk" -> Renaming "Junk E-Mail" to "Junk E-mail"
Changing MAPI "tasks" -> Renaming "Aufgaben" to "Tasks"
Changing MAPI "journal" -> Renaming "Journal" to "Journal"
Changing MAPI "wastebasket" -> Renaming "Gelöschte Objekte" to "Deleted Items"
Changing MAPI "inbox" -> Renaming "Posteingang" to "Inbox"
Changing MAPI "sentmail" -> Renaming "Gesendete Objekte" to "Sent Items"
Changing MAPI "outbox" -> Renaming "Postausgang" to "Outbox"
Changing MAPI "calendar" -> Renaming "Kalender" to "Calendar"
Changing MAPI "rss" -> Renaming "RSS Feeds" to "RSS Feeds"
Changing MAPI "drafts" -> Renaming "Entwürfe" to "Drafts"
Changing MAPI "contacts" -> Renaming "Kontakte" to "Contacts"
Changing MAPI "notes" -> Renaming "Notizen" to "Notes"
Changing MAPI "suggested_contacts" -> Renaming "Vorgeschlagene Kontakte" to "Suggested Contacts"
root@srv:~#
root@srv:~# kopano-localize-folders -u ullibasti --lang de_DE.UTF-8 --verbose
user
user: Changing localized folder names to "de_DE.UTF-8"
Running in verbose mode
Changing MAPI "junk" -> Renaming "Junk E-Mail" to "Junk E-Mail"
Changing MAPI "tasks" -> Renaming "Aufgaben" to "Aufgaben"
Changing MAPI "journal" -> Renaming "Journal" to "Journal"
Traceback (most recent call last):
  File "/usr/sbin/kopano-localize-folders", line 113, in <module>
    main()
  File "/usr/sbin/kopano-localize-folders", line 103, in main
    print 'Changing MAPI "%s" -> Renaming "%s" to "%s"' % (mapifolder, folderobject.name, localizedname)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

And what does the -m switch? I supposed that there are database modifications.

Kind regards
Basti

I’m on Debian 8 and Kopano version 8.4.2.0-0. I got the (almost) the same when trying to use nb_NO
kopano-localize-folders -u klaus --lang=nb_NO.UTF-8 --dry-run --verbose
klaus
klaus: Changing localized folder names to “nb_NO.UTF-8”
Running in verbose mode
Running in dry mode no changes will be made
Traceback (most recent call last):
File “/usr/sbin/kopano-localize-folders”, line 113, in <module>
main()
File “/usr/sbin/kopano-localize-folders”, line 103, in main
print ‘Changing MAPI “%s” -> Renaming “%s” to “%s”’ % (mapifolder, folderobject.name, localizedname)
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 1: ordinal not in range(128)

@klausade said in kopano-localize-folders:

UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 1: ordinal not in range(128)

I’ve seen such errors popping up in the past when the specified locale was not installed.

Sorry, forgot to mention, nb_NO is on the server.
lavd@mail:~$ locale -a
C
C.UTF-8
de_DE.utf8
en_US.utf8
nb_NO.utf8
POSIX

@klausade but is it also used in your current session? I’ve seen such errors popping up when the current session was only using the c locale.

@fbartels I would say “yes it used in the session”

klaus@mail:~$  cat /etc/default/locale 
#  File generated by update-locale
LANG=nb_NO.UTF-8
LANGUAGE="nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en"
klaus@mail:~$ locale
LANG=nb_NO.UTF-8
LANGUAGE=nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en
LC_CTYPE="nb_NO.UTF-8"
LC_NUMERIC="nb_NO.UTF-8"
LC_TIME="nb_NO.UTF-8"
LC_COLLATE="nb_NO.UTF-8"
LC_MONETARY="nb_NO.UTF-8"
LC_MESSAGES="nb_NO.UTF-8"
LC_PAPER="nb_NO.UTF-8"
LC_NAME="nb_NO.UTF-8"
LC_ADDRESS="nb_NO.UTF-8"
LC_TELEPHONE="nb_NO.UTF-8"
LC_MEASUREMENT="nb_NO.UTF-8"
LC_IDENTIFICATION="nb_NO.UTF-8"
LC_ALL=
klaus@mail:~$ env|grep -i lang
LANG=nb_NO.UTF-8
LANGUAGE=nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en

@klausade then I’m out of immediate ideas.

Hello.

I have the same behavior.

The locale is installed:

root@srv:~# locale -a
C
C.UTF-8
de_AT.utf8
de_DE.utf8
POSIX

I don’t get it why i can change the language to english but not back to german?

Kind regards
Basti

I made a ticket for this issue. https://jira.kopano.io/browse/KC-874

Thanks!

The problem is that the script mixes byte and unicode strings. This means that python’s implicit conversion to ascii is triggered, and because the folder names contain characters that can’t be represented in ascii, an exception is thrown.

The script probably has other hidden encoding bugs too. Unfortunately it’s really hard to get this right in Py2, I think the consensus is that the only way to really deal with it is to use unicode everywhere, converting at the “borders”.

Hi,

Can you try the version on https://stash.kopano.io/projects/KSC/repos/core-tools/browse/localize-folders.py
This should already have the fix for this.

Kind regards,

Robin

Hi Robin.

I tested the new python script and this version works fine with the german locale.

Thank you very much.

Kind regards

Hi,

Is it possible to change the names of a folder.
In outlook “Ongewenste E-mail” is spelled with a small “e” (Ongewenste e-mail)
Now i’ve to folders in Outlook.

Running in verbose mode
Running in dry mode no changes will be made
Changing MAPI "junk" -> Renaming "Ongewenste E-mail" to "Ongewenste E-mail"
Changing MAPI "tasks" -> Renaming "Taken" to "Taken"
Changing MAPI "journal" -> Renaming "Logboek" to "Logboek"
Changing MAPI "wastebasket" -> Renaming "Verwijderde items" to "Verwijderde items"
Changing MAPI "inbox" -> Renaming "Postvak IN" to "Postvak IN"
Changing MAPI "sentmail" -> Renaming "Verzonden items" to "Verzonden items"
Changing MAPI "outbox" -> Renaming "Postvak UIT" to "Postvak UIT"
Changing MAPI "calendar" -> Renaming "Agenda" to "Agenda"
Changing MAPI "rss" -> Renaming "RSS-kanalen" to "RSS-kanalen"
Changing MAPI "drafts" -> Renaming "Concepten" to "Concepten"
Changing MAPI "contacts" -> Renaming "Contactpersonen" to "Contactpersonen"
Changing MAPI "notes" -> Renaming "Notities" to "Notities"
Changing MAPI "suggested_contacts" -> Renaming "Voorgestelde Contactpersonen" to "Voorgestelde Contactper                            sonen"

HI @madpatrick,

This script is using the translation files of kopano-core so it’s need to be change there.
I notified the core team so they can make the change in the next release of kopano-core

To workaround this issue i created a custom .mo file with this change
https://owncloud.kopano.com/index.php/s/b9sXCbonCTFiUiE

Just put this file in /usr/share/locale/nl/LC_MESSAGES/ (Debian)

Hi @robing

I’ve found a script junk-folder-fix.py which rename the folder to the correct name.

https://stash.kopano.io/projects/KSC/repos/core-tools/browse

The only thing is now that i’ve double foldernames : Ongewenste e-mail

Do you see the two folders in WebApp or on a client that is using z-push.
In case of the last one the only thing you can do is recreate that profile.

The Junk folder is not a system folder and therefore a client just checks if it can find a folder that has that name and will just create a local folder if it can’t.

Hello Robing,

I see in Webapp just 1 folder.
The problem accurs only in Outlook.
In outlook the system folder is not the same as in Webapp