Java Examples for org.xnap.commons.i18n.I18n

The following java examples will help you to understand the usage of org.xnap.commons.i18n.I18n. These source code samples are taken from different open source projects.

Example 1
Project: candlepin-master  File: CandlepinModule.java View source code
@Override
public void configure() {
    // Bindings for our custom scope
    CandlepinRequestScope requestScope = new CandlepinRequestScope();
    bindScope(CandlepinRequestScoped.class, requestScope);
    bind(CandlepinRequestScope.class).toInstance(requestScope);
    bind(I18n.class).toProvider(I18nProvider.class);
    bind(BeanValidationEventListener.class).toProvider(ValidationListenerProvider.class);
    bind(MessageInterpolator.class).to(CandlepinMessageInterpolator.class);
    configureJPA();
    bind(PKIUtility.class).to(BouncyCastlePKIUtility.class).asEagerSingleton();
    bind(PKIReader.class).to(BouncyCastlePKIReader.class).asEagerSingleton();
    bind(X509ExtensionUtil.class);
    bind(ResolverUtil.class);
    bind(ConsumerResource.class);
    bind(ConsumerContentOverrideResource.class);
    bind(ActivationKeyContentOverrideResource.class);
    bind(HypervisorResource.class);
    bind(ConsumerTypeResource.class);
    bind(ContentResource.class);
    bind(AtomFeedResource.class);
    bind(EventResource.class);
    bind(PoolResource.class);
    bind(EntitlementResource.class);
    bind(OwnerResource.class);
    bind(OwnerProductResource.class);
    bind(OwnerContentResource.class);
    bind(RoleResource.class);
    bind(RootResource.class);
    bind(ProductResource.class);
    bind(SubscriptionResource.class);
    bind(ActivationKeyResource.class);
    bind(CertificateSerialResource.class);
    bind(CrlResource.class);
    bind(JobResource.class);
    bind(DateSource.class).to(DateSourceImpl.class).asEagerSingleton();
    bind(Enforcer.class).to(EntitlementRules.class);
    bind(EntitlementRulesTranslator.class);
    bind(PoolManager.class).to(CandlepinPoolManager.class);
    bind(ModeManager.class).to(ModeManagerImpl.class).asEagerSingleton();
    bind(SuspendModeTransitioner.class).asEagerSingleton();
    bind(ScheduledExecutorService.class).toProvider(ScheduledExecutorServiceProvider.class);
    bind(OwnerManager.class);
    bind(PoolRules.class);
    bind(CriteriaRules.class);
    bind(Entitler.class);
    bind(RulesResource.class);
    bind(AdminResource.class);
    bind(StatusResource.class);
    bind(EnvironmentResource.class);
    bind(NotSupportedExceptionMapper.class);
    bind(NotAuthorizedExceptionMapper.class);
    bind(NotFoundExceptionMapper.class);
    bind(NotAcceptableExceptionMapper.class);
    bind(NoLogWebApplicationExceptionMapper.class);
    bind(NotAllowedExceptionMapper.class);
    bind(InternalServerErrorExceptionMapper.class);
    bind(DefaultOptionsMethodExceptionMapper.class);
    bind(BadRequestExceptionMapper.class);
    bind(RollbackExceptionMapper.class);
    bind(ValidationExceptionMapper.class);
    bind(WebApplicationExceptionMapper.class);
    bind(FailureExceptionMapper.class);
    bind(ReaderExceptionMapper.class);
    bind(WriterExceptionMapper.class);
    bind(CandlepinExceptionMapper.class);
    bind(RuntimeExceptionMapper.class);
    bind(JAXBMarshalExceptionMapper.class);
    bind(JAXBUnmarshalExceptionMapper.class);
    bind(Principal.class).toProvider(PrincipalProvider.class);
    bind(JsRunnerProvider.class).asEagerSingleton();
    bind(JsRunner.class).toProvider(JsRunnerProvider.class);
    bind(RulesObjectMapper.class).asEagerSingleton();
    bind(UserResource.class);
    bind(UniqueIdGenerator.class).to(DefaultUniqueIdGenerator.class);
    bind(DistributorVersionResource.class);
    bind(DeletedConsumerResource.class);
    bind(CdnResource.class);
    bind(GuestIdResource.class);
    bind(AttributeValidator.class);
    bind(FactValidator.class);
    bind(DateFormatter.class);
    requestStaticInjection(CPRestrictions.class);
    configureInterceptors();
    configureAuth();
    bind(JsonProvider.class);
    configureEventSink();
    configurePinsetter();
    configureExporter();
    configureSwagger();
    // Async Jobs
    bind(RefreshPoolsJob.class);
    bind(EntitlerJob.class);
    requestStaticInjection(EntitlerJob.class);
    bind(HypervisorUpdateJob.class);
    // UeberCerts
    bind(UeberCertificateGenerator.class);
    // flexible end date for identity certificates
    bind(Function.class).annotatedWith(Names.named("endDateGenerator")).to(ExpiryDateFunction.class).in(Singleton.class);
    // only initialize if we've enabled AMQP integration
    if (config.getBoolean(ConfigProperties.AMQP_INTEGRATION_ENABLED)) {
        configureAmqp();
    }
    bind(CacheManager.class).toProvider(JCacheManagerProvider.class).in(Singleton.class);
}
Example 2
Project: orbisgis-master  File: WellKnownName.java View source code
/**
     * Build a new {@code WellKnownName} from a {@code String token}.
     * @param tok
     * @return 
     * A {@code WellKnownName} value. Defaults to {@link #CIRCLE} if the name does not match anything.
     */
public static WellKnownName fromString(String tok) {
    String token = tok == null ? "" : tok;
    if (token.equalsIgnoreCase(I18n.marktr("SQUARE"))) {
        return SQUARE;
    } else if (token.equalsIgnoreCase(I18n.marktr("HALFCIRCLE"))) {
        return HALFCIRCLE;
    } else if (token.equalsIgnoreCase(I18n.marktr("TRIANGLE"))) {
        return TRIANGLE;
    } else if (token.equalsIgnoreCase(I18n.marktr("STAR"))) {
        return STAR;
    } else if (token.equalsIgnoreCase(I18n.marktr("CROSS"))) {
        return CROSS;
    } else if (token.equalsIgnoreCase(I18n.marktr("X"))) {
        return X;
    } else {
        return CIRCLE;
    }
}
Example 3
Project: LimeWire-Pirate-Edition-master  File: I18n.java View source code
private static org.xnap.commons.i18n.I18n getNonCachedI18n(Locale locale) {
    return I18nFactory.getI18n(I18n.class, BASENAME, locale, I18nFactory.NO_CACHE);
}
Example 4
Project: Cryptographics-master  File: Configuration.java View source code
/**
	 * Returns the I18n instance for the package the given
	 * class is in
	 * 
	 * @param className fully qualified class name (ClassName.class)
	 * @return I18n instance to use the tr functions
	 */
@SuppressWarnings("rawtypes")
public I18n getI18n(Class className) {
    Locale loc = new Locale(this.getLanguageCode());
    I18n i18n = I18nFactory.getI18n(className, loc);
    return i18n;
}
Example 5
Project: bloatit-master  File: Localizator.java View source code
private I18n getI18n(final Locale locale) {
    if (localesCache.containsKey(locale)) {
        return localesCache.get(locale);
    }
    final I18n newI18n = I18nFactory.getI18n(Localizator.class, "i18n.Messages", locale);
    localesCache.put(locale.getLanguage(), newI18n);
    return newI18n;
}