• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python i18n.get_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ubiquity.i18n.get_string函数的典型用法代码示例。如果您正苦于以下问题:Python get_string函数的具体用法?Python get_string怎么用?Python get_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_string函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: on_link_clicked

 def on_link_clicked(self, widget, uri):
     # Connected in glade.
     lang = self.get_language()
     if not lang:
         lang = 'C'
     lang = lang.split('.')[0]  # strip encoding
     if uri == 'update':
         if self.updating_installer:
             return True
         self.updating_installer = True
         if not auto_update.update(self.controller._wizard):
             # no updates, so don't check again
             if self.release_notes_url:
                 text = i18n.get_string('release_notes_only', lang)
                 self.release_notes_label.set_markup(text)
             else:
                 self.release_notes_label.hide()
         self.updating_installer = False
     elif uri == 'release-notes':
         import subprocess
        # uri = self.release_notes_url.replace('${LANG}', lang)
         #subprocess.Popen(['sensible-browser', uri], close_fds=True,
          #                preexec_fn=misc.drop_all_privileges)
         uri = '/cdrom/.disk/release_notes_url' 
         subprocess.Popen(['/usr/bin/gedit', uri], close_fds=True,
                          preexec_fn=misc.drop_all_privileges)   #change by wangjingsi
     return True
开发者ID:IbpTeam,项目名称:ubiquity,代码行数:27,代码来源:ubi-language.py


示例2: get_string

 def get_string(self, name, lang=None, prefix=None):
     """Get the string name in the given lang or a default."""
     if lang is None:
         lang = self.locale
     if lang is None and 'LANG' in os.environ:
         lang = os.environ['LANG']
     return i18n.get_string(name, lang, prefix)
开发者ID:ericpaulbishop,项目名称:salamander,代码行数:7,代码来源:base.py


示例3: on_language_selection_changed

    def on_language_selection_changed(self):
        lang = self.selected_language()
        if not lang:
            return
        # strip encoding; we use UTF-8 internally no matter what
        lang = lang.split('.')[0]
        self.controller.translate(lang)
        if not self.only:
            release = misc.get_release()
            install_medium = misc.get_install_medium()
            install_medium = i18n.get_string(install_medium, lang)
            for widget in (self.page.try_install_text_label,
                           self.page.try_ubuntu,
                           self.page.install_ubuntu,
                           self.page.alpha_warning_label):
                text = widget.text()
                text = text.replace('${RELEASE}', release.name)
                text = text.replace('${MEDIUM}', install_medium)
                text = text.replace('Ubuntu', 'Kubuntu')
                widget.setText(text)

        self.update_release_notes_label()
        for w in self.widgetHidden:
            w.show()
        self.widgetHidden = []
开发者ID:IbpTeam,项目名称:ubiquity,代码行数:25,代码来源:ubi-language.py


示例4: plugin_translate

 def plugin_translate(self, lang):
     PreparePageBase.plugin_translate(self, lang)
     release = misc.get_release()
     from gi.repository import Gtk
     for widget in [self.prepare_foss_disclaimer]:
         text = i18n.get_string(Gtk.Buildable.get_name(widget), lang)
         text = text.replace('${RELEASE}', release.name)
         widget.set_label(text)
开发者ID:IbpTeam,项目名称:ubiquity,代码行数:8,代码来源:ubi-prepare.py


示例5: update_release_notes_label

 def update_release_notes_label(self):
     lang = self.selected_language()
     if not lang:
         return
     # strip encoding; we use UTF-8 internally no matter what
     lang = lang.split('.')[0]
     # Either leave the release notes label alone (both release notes and a
     # critical update are available), set it to just the release notes,
     # just the critical update, or neither, as appropriate.
     if self.page.release_notes_label:
         if self.release_notes_found and self.update_installer:
             text = i18n.get_string('release_notes_label', lang)
             self.page.release_notes_label.setText(text)
         elif self.release_notes_found:
             text = i18n.get_string('release_notes_only', lang)
             self.page.release_notes_label.setText(text)
         elif self.update_installer:
             text = i18n.get_string('update_installer_only', lang)
             self.page.release_notes_label.setText(text)
开发者ID:IbpTeam,项目名称:ubiquity,代码行数:19,代码来源:ubi-language.py


示例6: on_language_selection_changed

    def on_language_selection_changed(self, *args, **kwargs):
        lang = self.get_language()
        if not lang:
            return
        # strip encoding; we use UTF-8 internally no matter what
        lang = lang.split(".")[0]
        self.controller.translate(lang)
        import gtk

        ltr = i18n.get_string("default-ltr", lang, "ubiquity/imported")
        if ltr == "default:RTL":
            gtk.widget_set_default_direction(gtk.TEXT_DIR_RTL)
        else:
            gtk.widget_set_default_direction(gtk.TEXT_DIR_LTR)
        if not self.only:
            release_name = misc.get_release_name()
            install_medium = misc.get_install_medium()
            install_medium = i18n.get_string(install_medium, lang)
            for widget in (
                self.try_text_label,
                self.try_ubuntu,
                self.install_ubuntu,
                self.ready_text_label,
                self.alpha_warning_label,
            ):
                text = i18n.get_string(gtk.Buildable.get_name(widget), lang)
                text = text.replace("${RELEASE}", release_name)
                text = text.replace("${MEDIUM}", install_medium)
                widget.set_label(text)

            if self.release_notes_label:
                if self.release_notes_url and self.update_installer:
                    pass
                elif self.release_notes_url:
                    text = i18n.get_string("release_notes_only", lang)
                    self.release_notes_label.set_markup(text)
                elif self.update_installer:
                    text = i18n.get_string("update_installer_only", lang)
                    self.release_notes_label.set_markup(text)
                else:
                    self.release_notes_label.hide()
            for w in self.page.get_children():
                w.show()
开发者ID:JoliOS,项目名称:ubiquity,代码行数:43,代码来源:ubi-language.py


示例7: plugin_translate

    def plugin_translate(self, lang):
        PreparePageBase.plugin_translate(self, lang)
        release = misc.get_release()

        from gi.repository import Gtk
        for widget in [self.prepare_download_updates,
                       self.label_required_space,
                       self.label_free_space]:
            text = i18n.get_string(Gtk.Buildable.get_name(widget), lang)
            text = text.replace('${RELEASE}', release.name)
            widget.set_label(text)
开发者ID:maui-linux,项目名称:ubiquity,代码行数:11,代码来源:ubi-prepare.py


示例8: on_release_notes_link

 def on_release_notes_link(self, link):
     lang = self.selected_language()
     if link == "release-notes":
         if lang:
             lang = lang.split(".")[0].lower()
             url = self.release_notes_url.replace("${LANG}", lang)
             self.openURL(url)
     elif link == "update":
         if not auto_update.update(self.controller._wizard):
             # no updates, so don't check again
             text = i18n.get_string("release_notes_only", lang)
             self.page.release_notes_label.setText(text)
开发者ID:JoliOS,项目名称:ubiquity,代码行数:12,代码来源:ubi-language.py


示例9: on_release_notes_link

 def on_release_notes_link(self, link):
     lang = self.selected_language()
     if link == "release-notes":
         if lang:
             lang = lang.split('.')[0].lower()
             url = self.release_notes_url.replace('${LANG}', lang)
             self.openURL(url)
     elif link == "update":
         if self.updating_installer:
             return
         self.updating_installer = True
         if not auto_update.update(self.controller._wizard):
             # no updates, so don't check again
             text = i18n.get_string('release_notes_only', lang)
             self.page.release_notes_label.setText(text)
         self.updating_installer = False
开发者ID:IbpTeam,项目名称:ubiquity,代码行数:16,代码来源:ubi-language.py


示例10: on_link_clicked

    def on_link_clicked(self, widget, uri):
        # Connected in glade.
        lang = self.get_language()
        lang = lang.split(".")[0]  # strip encoding
        if uri == "update":
            if not auto_update.update(self.controller._wizard):
                # no updates, so don't check again
                if self.release_notes_url:
                    text = i18n.get_string("release_notes_only", lang)
                    self.release_notes_label.set_markup(text)
                else:
                    self.release_notes_label.hide()
        elif uri == "release-notes":
            import subprocess

            uri = self.release_notes_url.replace("${LANG}", lang)
            subprocess.Popen(["sensible-browser", uri], close_fds=True, preexec_fn=misc.drop_all_privileges)
        return True
开发者ID:JoliOS,项目名称:ubiquity,代码行数:18,代码来源:ubi-language.py


示例11: progress_loop

    def progress_loop(self):
        """prepare, copy and config the system in the core install process."""
        syslog.syslog('progress_loop()')

        self.current_page = None

        slideshow_dir = '/usr/share/ubiquity-slideshow'
        slideshow_locale = self.slideshow_get_available_locale(slideshow_dir, self.locale)
        slideshow_main = slideshow_dir + '/slides/index.html'

        s = self.app.desktop().availableGeometry()
        fail = None
        if os.path.exists(slideshow_main):
            if s.height >= 600 and s.width >= 800:
                slides = 'file://' + slideshow_main
                if slideshow_locale != 'c': #slideshow will use default automatically
                    slides += '#?locale=' + slideshow_locale
                    ltr = i18n.get_string('default-ltr', slideshow_locale, 'ubiquity/imported')
                    if ltr == 'default:RTL':
                        slides += '?rtl'
                try:
                    from PyQt4.QtWebKit import QWebView
                    from PyQt4.QtWebKit import QWebPage

                    def openLink(qUrl):
                        QDesktopServices.openUrl(qUrl)

                    webView = QWebView()

                    webView.linkClicked.connect(openLink)

                    webView.setContextMenuPolicy(Qt.NoContextMenu)
                    webView.page().setLinkDelegationPolicy(QWebPage.DelegateExternalLinks)
                    webView.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
                    webView.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
                    webView.setFixedSize(700,420)

                    webView.load(QUrl(slides))

                    #add the webview to the extra frame of the progress dialog
                    self.progressDialog.extraFrame.layout().addWidget(webView)
                    self.progressDialog.extraFrame.setVisible(True)
                except ImportError:
                    fail = 'Webkit not present.'
            else:
                fail = 'Display < 800x600 (%sx%s).' % (s.width, s.height)
        else:
            fail = 'No slides present for %s.' % slideshow_dir
        if fail:
            syslog.syslog('Not displaying the slideshow: %s' % fail)

        self.progressDialog.show()

        self.debconf_progress_start(
            0, 100, self.get_string('ubiquity/install/title'))
        self.debconf_progress_region(0, 15)

        if not self.oem_user_config:
            self.start_debconf()
            dbfilter = partman_commit.PartmanCommit(self)
            if dbfilter.run_command(auto_process=True) != 0:
                while self.progress_position.depth() != 0:
                    self.debconf_progress_stop()
                self.progressDialog.hide()
                self.return_to_partitioning()
                return

        # No return to partitioning from now on
        self.installing_no_return = True

        self.debconf_progress_region(15, 100)

        self.start_debconf()
        dbfilter = install.Install(self)
        ret = dbfilter.run_command(auto_process=True)
        if ret != 0:
            self.installing = False
            if ret == 3:
                # error already handled by Install
                sys.exit(ret)
            elif (os.WIFSIGNALED(ret) and
                  os.WTERMSIG(ret) in (signal.SIGINT, signal.SIGKILL,
                                       signal.SIGTERM)):
                sys.exit(ret)
            elif os.path.exists('/var/lib/ubiquity/install.trace'):
                tbfile = open('/var/lib/ubiquity/install.trace')
                realtb = tbfile.read()
                tbfile.close()
                raise RuntimeError, ("Install failed with exit code %s\n%s" %
                                     (ret, realtb))
            else:
                raise RuntimeError, ("Install failed with exit code %s; see "
                                     "/var/log/syslog" % ret)

        while self.progress_position.depth() != 0:
            self.debconf_progress_stop()

        # just to make sure
        self.progressDialog.hide()

#.........这里部分代码省略.........
开发者ID:AlfredArouna,项目名称:ubiquity,代码行数:101,代码来源:kde_ui.py


示例12: get_string

 def get_string(self, name, lang=None):
     """Get the string name in the given lang or a default."""
     if lang is None:
         lang = self.locale
     return i18n.get_string(name, lang)
开发者ID:jamieboo,项目名称:ubiquity,代码行数:5,代码来源:base.py



注:本文中的ubiquity.i18n.get_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python misc.execute函数代码示例发布时间:2022-05-27
下一篇:
Python filteredcommand.FilteredCommand类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap