Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import os
- from gettext import *
- _ = gettext
- # Returns a dictionary with the xdg dirs for that user,
- # or the default xdg dirs based on the current language,
- # if that user's xdg dirs aren't set.
- # Raises an error if the user doesn't exist.
- def get_xdg_dirs(user, lang=""):
- if lang:
- oldlang = os.environ['LANG']
- os.environ["LANG"] = lang
- bindtextdomain("xdg-user-dirs")
- textdomain("xdg-user-dirs")
- result = {
- 'Desktop': _('Desktop'),
- 'Downloads': _('Downloads'),
- 'Applications': _('Applications'),
- 'Documents': _('Documents'),
- 'Download': _('Download'),
- 'Movies': _('Movies'),
- 'Music': _('Music'),
- 'Photos': _('Photos'),
- 'Pictures': _('Pictures'),
- 'Projects': _('Projects'),
- 'Public': _('Public'),
- 'Share': _('Share'),
- 'Templates': _('Templates'),
- 'Videos': _('Videos')
- }
- if lang:
- os.environ['LANG'] = oldlang
- return result
- for lang in ('el', 'ru'):
- print "==== Language=%s ====" % lang
- for k, v in get_xdg_dirs("alkisg", lang).iteritems():
- print "%s=%s" % (k, v)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement