當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Translation.t函數代碼示例

本文整理匯總了TypeScript中@util/Translation.t函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript t函數的具體用法?TypeScript t怎麽用?TypeScript t使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了t函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: insertDevices

async function insertDevices(devices: Device[], identityManager: IdentityManager, listElement) {
   if (devices.length === 0) {
      listElement.empty().append($('<p>').text(Translation.t('No_devices_available')));

      return;
   }

   for (let device of devices) {
      //@TODO show spinner
      let properties = await getDeviceProperties(device, identityManager);
      let element = $(omemoDeviceItemTemplate(properties));

      let lastUsedElement = element.find('.jsxc-omemo-device-last-used');

      if (properties.lastUsed) {
         DateTime.stringify(properties.lastUsed.getTime(), lastUsedElement);
      } else {
         lastUsedElement.text(Translation.t('never'));
      }

      attachActionHandler(element, device);

      listElement.append(element);
   }
}
開發者ID:jsxc,項目名稱:jsxc,代碼行數:25,代碼來源:omemoDevices.ts

示例2:

   let basicData = resources.map((resource) => {
      let presence = Presence[contact.getPresence(resource)];

      return {
         resource,
         client: Translation.t('loading'),
         presence: Translation.t(presence),
      }
   });
開發者ID:jsxc,項目名稱:jsxc,代碼行數:9,代碼來源:vcard.ts

示例3: onOnceIncoming

   public onOnceIncoming() {
      Notification.notify({
         title: Translation.t('Incoming_stream'),
         message: Translation.t('from_sender') + this.peerContact.getName(),
         source: this.peerContact
      });

      // send signal to partner
      this.session.ring();
   }
開發者ID:jsxc,項目名稱:jsxc,代碼行數:10,代碼來源:JingleStreamSession.ts

示例4: showForm

function showForm(form: Form, contact: MultiUserContact, connection: IConnection) {
   let formElement = form.toHTML();

   let submitButton = $(`<div class="form-group">
      <div class="col-sm-offset-4 col-sm-8">
         <button class="jsxc-button jsxc-button--default jsxc-js-close" type="button">${Translation.t('Cancel')}</button>
         <button class="jsxc-button jsxc-button--primary" type="submit">${Translation.t('Save')}</button>
      </div>
   </div>`);

   formElement.append(submitButton);

   dialog.getDom().empty().append(formElement);

   return new Promise((resolve, reject) => {
      formElement.submit((ev) => { //@TODO block form
         ev.preventDefault();

         let form = Form.fromHTML(formElement.get(0));

         contact.setRoomConfiguration(form.toJSON());
         let submitPromise = connection.getMUCService()
            .submitRoomConfiguration(contact.getJid(), form)
            .then((stanza) => {
               Log.debug('Room configuration submitted');

               dialog.close();

               return stanza;
            });

         resolve(submitPromise);
      });

      formElement.find('.jsxc-js-close').click((ev) => {
         ev.preventDefault();

         let cancelRoomPromise = connection.getMUCService()
            .cancelRoomConfiguration(contact.getJid())
            .then(() => {
               Log.debug('Room configuration canceled');

               dialog.close();

               return CANCELED;
            });

         resolve(cancelRoomPromise);
      });
   })
}
開發者ID:jsxc,項目名稱:jsxc,代碼行數:51,代碼來源:multiUserRoomConfiguration.ts

示例5: addCleanUpAction

function addCleanUpAction(omemo: Omemo, dom: JQuery) {
   let buttonElement = $('<button>');
   buttonElement.addClass('jsxc-button jsxc-button--default')
   buttonElement.text(Translation.t('Clean_up_own_devices'));
   buttonElement.click((ev) => {
      ev.preventDefault();

      omemo.cleanUpDeviceList().then(localDeviceId => {
         dom.find('.jsxc-omemo-owndevices').children().not(`[data-device-id="${localDeviceId}"]`).remove();
      });
   });
   buttonElement.appendTo(dom);

   let explanationElement = $('<p>');
   explanationElement.addClass('jsxc-hint jsxc-max-width');
   explanationElement.text(Translation.t('omemo-clean-up-explanation'));
   explanationElement.appendTo(dom);
}
開發者ID:jsxc,項目名稱:jsxc,代碼行數:18,代碼來源:omemoDevices.ts

示例6: vcardErrorCallback

function vcardErrorCallback() {
   let dialogElement = dialog.getDom();

   dialogElement.find('.jsxc-waiting').remove();

   let content = '<p>';
   content += Translation.t('Sorry_your_buddy_doesnt_provide_any_information');
   content += '</p>';

   dialogElement.append(content);
}
開發者ID:jsxc,項目名稱:jsxc,代碼行數:11,代碼來源:vcard.ts

示例7: convertToTemplateData

function convertToTemplateData(vCardData): any[] {
   let properties = [];

   for (let name in vCardData) {
      let value = vCardData[name];
      let childProperties;

      if (typeof value === 'object' && value !== null) {
         childProperties = convertToTemplateData(value);
         value = undefined;
      }

      properties.push({
         name: Translation.t(name),
         value,
         properties: childProperties
      });
   }

   return properties;
}
開發者ID:jsxc,項目名稱:jsxc,代碼行數:21,代碼來源:vcard.ts

示例8: translate

export function translate(str: string, param) {
   return Translation.t(str, param);
}
開發者ID:jsxc,項目名稱:jsxc,代碼行數:3,代碼來源:index.ts


注:本文中的@util/Translation.t函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。