/** * @param key English variant * @param table The identifier of the table to lookup the string in. Could be a file. * @return Localized from table */ public static String localizedString(final String key, final String table) { final String lookup = get().localize(key, table); if(StringUtils.contains(lookup, "{0}")) { return StringUtils.replace(lookup, "'", "''"); } return lookup; } }
@Action public void languagePopupClicked(NSPopUpButton sender) { LocaleFactory.get().setDefault(sender.selectedItem().representedObject()); }
final String localized = LocaleFactory.get().localize(key, "SDS"); this.append(buffer, localized); if(StringUtils.equals(localized, key)) {
protected Credentials prompt(final LoginOptions options, final Credentials credentials) { if(options.save && options.keychain) { if(!PreferencesFactory.get().getBoolean("keychain.secure")) { console.printf(String.format("WARNING! Passwords are stored in plain text in %s.", LocalFactory.get(SupportDirectoryFinderFactory.get().find(), "credentials").getAbbreviatedPath())); } credentials.setSaved(prompt.prompt(LocaleFactory.get().localize("Save password", "Credentials"))); } else { credentials.setSaved(options.save); } return credentials; } }
@Override public boolean menuUpdateItemAtIndex(NSMenu menu, NSMenuItem item, NSInteger row, boolean cancel) { if(row.intValue() == index) { item.setEnabled(true); item.setTitle(LocaleFactory.get().localize("History", "Localizable")); item.setImage(IconCacheFactory.<NSImage>get().iconNamed("history.tiff", 16)); item.setTarget(this.id()); item.setAction(Foundation.selector("historyMenuClicked:")); item.setSubmenu(historyMenu); } if(row.intValue() == index + 1) { item.setEnabled(true); item.setTitle(LocaleFactory.get().localize("Bonjour", "Main")); item.setImage(IconCacheFactory.<NSImage>get().iconNamed("rendezvous.tiff", 16)); item.setSubmenu(rendezvousMenu); } if(row.intValue() == index + 2) { menu.removeItemAtIndex(row); menu.insertItem_atIndex(this.seperator(), row); } if(row.intValue() > index + 2) { Host h = this.itemForIndex(row); item.setTitle(BookmarkNameProvider.toString(h)); item.setTarget(this.id()); item.setImage(IconCacheFactory.<NSImage>get().iconNamed(h.getProtocol().icon(), preferences.getInteger("bookmark.menu.icon.size"))); item.setAction(this.getDefaultAction()); item.setRepresentedObject(h.getUuid()); } return super.menuUpdateItemAtIndex(menu, item, row, cancel); }