java.util.ResourceBundle Java Examples

The following examples show how to use java.util.ResourceBundle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComponentOrientation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the orientation appropriate for the given ResourceBundle's
 * localization.  Three approaches are tried, in the following order:
 * <ol>
 * <li>Retrieve a ComponentOrientation object from the ResourceBundle
 *      using the string "Orientation" as the key.
 * <li>Use the ResourceBundle.getLocale to determine the bundle's
 *      locale, then return the orientation for that locale.
 * <li>Return the default locale's orientation.
 * </ol>
 *
 * @deprecated As of J2SE 1.4, use {@link #getOrientation(java.util.Locale)}.
 */
@Deprecated
public static ComponentOrientation getOrientation(ResourceBundle bdl)
{
    ComponentOrientation result = null;

    try {
        result = (ComponentOrientation)bdl.getObject("Orientation");
    }
    catch (Exception e) {
    }

    if (result == null) {
        result = getOrientation(bdl.getLocale());
    }
    if (result == null) {
        result = getOrientation(Locale.getDefault());
    }
    return result;
}
 
Example #2
Source File: ScriptRuntime.java    From JsDroidCmd with Mozilla Public License 2.0 6 votes vote down vote up
public String getMessage(String messageId, Object[] arguments) {
    final String defaultResource
        = "org.mozilla.javascript.resources.Messages";

    Context cx = Context.getCurrentContext();
    Locale locale = cx != null ? cx.getLocale() : Locale.getDefault();

    // ResourceBundle does caching.
    ResourceBundle rb = ResourceBundle.getBundle(defaultResource, locale);

    String formatString;
    try {
        formatString = rb.getString(messageId);
    } catch (java.util.MissingResourceException mre) {
        throw new RuntimeException
            ("no message resource found for message property "+ messageId);
    }

    /*
     * It's OK to format the string, even if 'arguments' is null;
     * we need to format it anyway, to make double ''s collapse to
     * single 's.
     */
    MessageFormat formatter = new MessageFormat(formatString);
    return formatter.format(arguments);
}
 
Example #3
Source File: Level.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private String computeLocalizedLevelName(Locale newLocale) {
    ResourceBundle rb = ResourceBundle.getBundle(resourceBundleName, newLocale);
    final String localizedName = rb.getString(name);

    final boolean isDefaultBundle = defaultBundle.equals(resourceBundleName);
    if (!isDefaultBundle) return localizedName;

    // This is a trick to determine whether the name has been translated
    // or not. If it has not been translated, we need to use Locale.ROOT
    // when calling toUpperCase().
    final Locale rbLocale = rb.getLocale();
    final Locale locale =
            Locale.ROOT.equals(rbLocale)
            || name.equals(localizedName.toUpperCase(Locale.ROOT))
            ? Locale.ROOT : rbLocale;

    // ALL CAPS in a resource bundle's message indicates no translation
    // needed per Oracle translation guideline.  To workaround this
    // in Oracle JDK implementation, convert the localized level name
    // to uppercase for compatibility reason.
    return Locale.ROOT.equals(locale) ? name : localizedName.toUpperCase(locale);
}
 
Example #4
Source File: TestBug4179766.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Ensure that cached resources for different ClassLoaders
 * are cached seperately
 */
private void doTest(boolean sameHash) throws Exception {
    ResourceBundle b1 = getResourceBundle(new Loader(sameHash), "Bug4179766Resource");
    if (b1 == null) {
       errln("Resource not found: Bug4179766Resource");
    }
    ResourceBundle b2 = getResourceBundle(new Loader(sameHash), "Bug4179766Resource");
    if (b2 == null) {
       errln("Resource not found: Bug4179766Resource");
    }
    printIDInfo("[bundle1]",b1);
    printIDInfo("[bundle2]",b2);
    if (b1 == b2) {
       errln("Same object returned by different ClassLoaders");
    }
}
 
Example #5
Source File: Bug6299235Test.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
    /* Try to load "sun.awt.resources.awt_ru_RU.properties which
     * is in awtres.jar.
     */
    ResourceBundle russionAwtRes = ResourceBundle.getBundle("sun.awt.resources.awt",
                                                            new Locale("ru", "RU"),
                                                            CoreResourceBundleControl.getRBControlInstance());

    /* If this call throws MissingResourceException, the test fails. */
    if (russionAwtRes != null) {
        String result = russionAwtRes.getString("foo");
        if (result.equals("bar")) {
            System.out.println("Bug6299235Test passed");
        } else {
            System.err.println("Bug6299235Test failed");
            throw new Exception("Resource found, but value of key foo is not correct\n");
        }
    }
}
 
Example #6
Source File: NbModuleProjectTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testMemoryConsumption() throws Exception { // #90195
    assertSize("java.project is not too big", Arrays.asList(javaProjectProject.evaluator(), javaProjectProject.getHelper()), 2345678, new MemoryFilter() {
        final Class<?>[] REJECTED = {
            Project.class,
            FileObject.class,
            ClassLoader.class,
            Class.class,
            ModuleInfo.class,
            LogManager.class,
            RequestProcessor.class,
            ResourceBundle.class,
        };
        public @Override boolean reject(Object obj) {
            for (Class<?> c : REJECTED) {
                if (c.isInstance(obj)) {
                    return true;
                }
            }
            return false;
        }
    });
}
 
Example #7
Source File: TestResourceBundleELResolver.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    ResourceBundleELResolver resolver = new ResourceBundleELResolver();
    ELContext context = new ELContextImpl();

    ResourceBundle resourceBundle = new TesterResourceBundle(
            new Object[][] { { "key", "value" } });
    @SuppressWarnings("unchecked")
    Iterator<FeatureDescriptor> result = resolver.getFeatureDescriptors(
            context, resourceBundle);

    while (result.hasNext()) {
        FeatureDescriptor featureDescriptor = result.next();
        Assert.assertEquals("key", featureDescriptor.getDisplayName());
        Assert.assertEquals("key", featureDescriptor.getName());
        Assert.assertEquals("", featureDescriptor.getShortDescription());
        Assert.assertFalse(featureDescriptor.isExpert());
        Assert.assertFalse(featureDescriptor.isHidden());
        Assert.assertTrue(featureDescriptor.isPreferred());
        Assert.assertEquals(String.class,
                featureDescriptor.getValue(ELResolver.TYPE));
        Assert.assertEquals(Boolean.TRUE, featureDescriptor
                .getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
 
Example #8
Source File: DatatypeException.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Overrides this method to get the formatted&localized error message.
 *
 * REVISIT: the system locale is used to load the property file.
 *          do we want to allow the appilcation to specify a
 *          different locale?
 */
public String getMessage() {
    ResourceBundle resourceBundle = null;
    resourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
    if (resourceBundle == null)
        throw new MissingResourceException("Property file not found!", "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key);

    String msg = resourceBundle.getString(key);
    if (msg == null) {
        msg = resourceBundle.getString("BadMessageKey");
        throw new MissingResourceException(msg, "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key);
    }

    if (args != null) {
        try {
            msg = java.text.MessageFormat.format(msg, args);
        } catch (Exception e) {
            msg = resourceBundle.getString("FormatFailed");
            msg += " " + resourceBundle.getString(key);
        }
    }

    return msg;
}
 
Example #9
Source File: TestBug4179766.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
* Ensure the resource cache is working correctly for a single
* resource from a single loader.  If we get the same resource
* from the same loader twice, we should get the same resource.
*/
public void testCache() throws Exception {
    Loader loader = new Loader(false);
    ResourceBundle b1 = getResourceBundle(loader, "Bug4179766Resource");
    if (b1 == null) {
        errln("Resource not found: Bug4179766Resource");
    }
    ResourceBundle b2 = getResourceBundle(loader, "Bug4179766Resource");
    if (b2 == null) {
        errln("Resource not found: Bug4179766Resource");
    }
    printIDInfo("[bundle1]",b1);
    printIDInfo("[bundle2]",b2);
    if (b1 != b2) {
        errln("Different objects returned by same ClassLoader");
    }
}
 
Example #10
Source File: Logger.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets a resource bundle on this logger.
 * All messages will be logged using the given resource bundle for its
 * specific {@linkplain ResourceBundle#getLocale locale}.
 * @param bundle The resource bundle that this logger shall use.
 * @throws NullPointerException if the given bundle is {@code null}.
 * @throws IllegalArgumentException if the given bundle doesn't have a
 *         {@linkplain ResourceBundle#getBaseBundleName base name},
 *         or if this logger already has a resource bundle set but
 *         the given bundle has a different base name.
 * @throws SecurityException if a security manager exists,
 *         this logger is not anonymous, and the caller
 *         does not have LoggingPermission("control").
 * @since 1.8
 */
public void setResourceBundle(ResourceBundle bundle) {
    checkPermission();

    // Will throw NPE if bundle is null.
    final String baseName = bundle.getBaseBundleName();

    // bundle must have a name
    if (baseName == null || baseName.isEmpty()) {
        throw new IllegalArgumentException("resource bundle must have a name");
    }

    synchronized (this) {
        LoggerBundle lb = loggerBundle;
        final boolean canReplaceResourceBundle = lb.resourceBundleName == null
                || lb.resourceBundleName.equals(baseName);

        if (!canReplaceResourceBundle) {
            throw new IllegalArgumentException("can't replace resource bundle");
        }


        loggerBundle = LoggerBundle.get(baseName, bundle);
    }
}
 
Example #11
Source File: WebUtil.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static void clearResourceBundleCache() throws Exception {
	WebUtil.getServiceLocator().getToolsService().clearResourceBundleCache();
	//https://stackoverflow.com/questions/4325164/how-to-reload-resource-bundle-in-web-application
	ResourceBundle.clearCache(Thread.currentThread().getContextClassLoader());
	Iterator<ApplicationResourceBundle> it = ApplicationAssociate.getCurrentInstance().getResourceBundles().values().iterator();
	while (it.hasNext()) {
		ApplicationResourceBundle appBundle = it.next();
		Map<Locale, ResourceBundle> resources = CommonUtil.getDeclaredFieldValue(appBundle, "resources");
		resources.clear();
	}
}
 
Example #12
Source File: Logger.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static ResourceBundle findSystemResourceBundle(final Locale locale) {
    // the resource bundle is in a restricted package
    return AccessController.doPrivileged(new PrivilegedAction<ResourceBundle>() {
        @Override
        public ResourceBundle run() {
            try {
                return ResourceBundle.getBundle(SYSTEM_LOGGER_RB_NAME,
                                                locale);
            } catch (MissingResourceException e) {
                throw new InternalError(e.toString());
            }
        }
    });
}
 
Example #13
Source File: Resources.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the message corresponding to the key in the bundle or a text
 * describing it's missing.
 *
 * @param rb the resource bundle
 * @param key the key
 *
 * @return the message
 */
private static String getMessage(ResourceBundle rb, String key) {
    if (rb == null) {
        return "missing resource bundle";
    }
    try {
        return rb.getString(key);
    } catch (MissingResourceException mre) {
        return "missing message for key = \"" + key
                + "\" in resource bundle ";
    }
}
 
Example #14
Source File: IsoFields.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getDisplayName(Locale locale) {
    Objects.requireNonNull(locale, "locale");
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
                                .getLocaleResources(locale);
    ResourceBundle rb = lr.getJavaTimeFormatData();
    return rb.containsKey("field.week") ? rb.getString("field.week") : toString();
}
 
Example #15
Source File: ExpressionIdentifier.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
boolean collectFirsts(ResourceBundle language, Set<String> firsts) {
    Set<String> f = new HashSet<>(interpreter.getAllItemTokens(language.getLocale()));
    if (stopper != null) {
        f.removeAll(stopper.getFirsts(language));
    }
    firsts.addAll(f);
    return true;
}
 
Example #16
Source File: AbstractLoggerWrapper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void logrb(PlatformLogger.Level level, ResourceBundle bundle,
                  String msg, Throwable thrown) {
    final PlatformLogger.Bridge platformProxy = platformProxy();
    if (platformProxy == null)  {
        wrapped().log(level.systemLevel(), bundle, msg, thrown);
    } else {
        platformProxy.logrb(level, bundle, msg, thrown);
    }
}
 
Example #17
Source File: ModelCommandSpecTest.java    From picocli with Apache License 2.0 5 votes vote down vote up
@Test
public void testCommandSpecAddSubcommand_SubcommandInheritsResourceBundle() {
    ResourceBundle rb = ResourceBundle.getBundle("picocli.SharedMessages");
    CommandSpec spec = CommandSpec.wrapWithoutInspection(null);
    spec.resourceBundle(rb);
    assertSame(rb, spec.resourceBundle());

    CommandSpec sub = CommandSpec.wrapWithoutInspection(null);
    spec.addSubcommand("a", new CommandLine(sub));

    assertSame(rb, sub.resourceBundle());
}
 
Example #18
Source File: MessageBundleTest.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@BeforeTransaction
public void beforeTransaction()  {
    localeEn = new Locale("en");
    localeFr = new Locale("fr");

    baseName = "basename";
    moduleName = "modulename";

    Assert.notNull(messageBundleService);
    resourceBundleEN = ResourceBundle.getBundle("org/sakaiproject/messagebundle/impl/test/bundle", localeEn);
    resourceBundleFr = ResourceBundle.getBundle("org/sakaiproject/messagebundle/impl/test/bundle", localeFr);

    messageBundleService.saveOrUpdate(baseName, moduleName, resourceBundleEN, localeEn);
    messageBundleService.saveOrUpdate(baseName, moduleName, resourceBundleFr, localeFr);
}
 
Example #19
Source File: Bug4168625Class.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** return the specified resource or null if not found */
public ResourceBundle getResourceBundle(String resource, Locale locale) {
    try {
        return ResourceBundle.getBundle(resource, locale);
    } catch (MissingResourceException e) {
        return null;
    }
}
 
Example #20
Source File: FrmEditMrbFormat.java    From Course_Generator with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates new form frmSettings
 */
public FrmEditMrbFormat(Window parent, CgSettings settings) {
	super(parent);
	this.settings = settings;
	bundle = java.util.ResourceBundle.getBundle("course_generator/Bundle");
	initComponents();
	setModal(true);
}
 
Example #21
Source File: NbModuleLogHandler.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static StringBuffer toString(LogRecord record) {
    StringBuffer sb = new StringBuffer();
    sb.append('[');
    sb.append(record.getLoggerName());
    sb.append("] THREAD: ");
    sb.append(Thread.currentThread().getName());
    sb.append(" MSG: ");
    String txt = record.getMessage();
    ResourceBundle b = record.getResourceBundle();
    if (b != null) {
        try {
            txt = b.getString(txt);
        } catch (MissingResourceException ex) {
            // ignore
        }
    }
    if (txt != null && record.getParameters() != null) {
        txt = MessageFormat.format(txt, record.getParameters());
    }
    sb.append(txt);
    Throwable t = record.getThrown();
    if (t != null) {
        sb.append('\n');
        StringWriter w = new StringWriter();
        t.printStackTrace(new PrintWriter(w));
        sb.append(w.toString().replace("\tat ", "  ").replace("\t... ", "  ... "));
    }
    sb.append('\n');
    return sb;
}
 
Example #22
Source File: BootstrapLogger.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void logrb(PlatformLogger.Level level, ResourceBundle bundle,
        String msg, Object... params) {
    if (checkBootstrapping()) {
        push(LogEvent.valueOf(this, level, null, null, bundle, msg, params));
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        spi.logrb(level, bundle, msg, params);
    }
}
 
Example #23
Source File: Util.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void initMessages() throws Exit {
    try {
        m = ResourceBundle.getBundle("com.sun.tools.javah.resources.l10n");
    } catch (MissingResourceException mre) {
        fatal("Error loading resources.  Please file a bug report.", mre);
    }
}
 
Example #24
Source File: DefaultConfiguration.java    From ebics-java-client with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Creates a new application configuration.
 * @param rootDir the root directory
 */
public DefaultConfiguration(String rootDir) {
  this.rootDir = rootDir;
  bundle = ResourceBundle.getBundle(RESOURCE_DIR);
  properties = new Properties();
  logger = new DefaultEbicsLogger();
  serializationManager = new DefaultSerializationManager();
  traceManager = new DefaultTraceManager();
}
 
Example #25
Source File: JSONObject.java    From Overchan-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
     * Construct a JSONObject from a ResourceBundle.
     *
     * @param baseName
     *            The ResourceBundle base name.
     * @param locale
     *            The Locale to load the ResourceBundle for.
     * @throws JSONException
     *             If any JSONExceptions are detected.
     */
    public JSONObject(String baseName, Locale locale) throws JSONException {
        this();
        ResourceBundle bundle = ResourceBundle.getBundle(baseName, locale,
                Thread.currentThread().getContextClassLoader());

// Iterate through the keys in the bundle.

        Enumeration<String> keys = bundle.getKeys();
        while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            if (key != null) {

// Go through the path, ensuring that there is a nested JSONObject for each
// segment except the last. Add the value using the last segment's name into
// the deepest nested JSONObject.

                String[] path = ((String) key).split("\\.");
                int last = path.length - 1;
                JSONObject target = this;
                for (int i = 0; i < last; i += 1) {
                    String segment = path[i];
                    JSONObject nextTarget = target.optJSONObject(segment);
                    if (nextTarget == null) {
                        nextTarget = new JSONObject();
                        target.put(segment, nextTarget);
                    }
                    target = nextTarget;
                }
                target.put(path[last], bundle.getString((String) key));
            }
        }
    }
 
Example #26
Source File: LocaleResources.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public String[] getNumberPatterns() {
    String[] numberPatterns = null;

    removeEmptyReferences();
    ResourceReference data = cache.get(NUMBER_PATTERNS_CACHEKEY);

    if (data == null || ((numberPatterns = (String[]) data.get()) == null)) {
        ResourceBundle resource = localeData.getNumberFormatData(locale);
        numberPatterns = resource.getStringArray("NumberPatterns");
        cache.put(NUMBER_PATTERNS_CACHEKEY,
                  new ResourceReference(NUMBER_PATTERNS_CACHEKEY, (Object) numberPatterns, referenceQueue));
    }

    return numberPatterns;
}
 
Example #27
Source File: SootPlugin.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the string from the plugin's resource bundle,
 * or 'key' if not found.
 */
public static String getResourceString(String key) {
	ResourceBundle bundle= SootPlugin.getDefault().getResourceBundle();
	try {
		return bundle.getString(key);
	} catch (MissingResourceException e) {
		return key;
	}
}
 
Example #28
Source File: ResourceBundleTest.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
protected TestResult checkResourceBundleExists(PortletConfig config,
                                               PortletRequest request) {
    TestResult result = new TestResult();
    result.setDescription("Ensure the resource bundle is not null.");

    ResourceBundle bundle = config.getResourceBundle(request.getLocale());
    if (bundle != null) {
    	result.setReturnCode(TestResult.PASSED);
    } else {
    	result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Unable to retrieve resource bundle "
        		+ "for locale: " + request.getLocale());
    }
    return result;
}
 
Example #29
Source File: IMDBList.java    From drftpd with GNU General Public License v2.0 5 votes vote down vote up
public ListElementsContainer addElements(DirectoryHandle dir, ListElementsContainer container) {
    ResourceBundle bundle = container.getCommandManager().getResourceBundle();
    if (IMDBConfig.getInstance().barEnabled()) {
        IMDBVFSDataNFO imdbData = new IMDBVFSDataNFO(dir);
        IMDBInfo imdbInfo = imdbData.getIMDBInfoFromCache();
        if (imdbInfo != null) {
            if (imdbInfo.getMovieFound()) {
                Map<String, Object> env = new HashMap<>();
                env.put("title", imdbInfo.getTitle());
                env.put("year", imdbInfo.getYear() != null ? imdbInfo.getYear() : "9999");
                env.put("language", imdbInfo.getLanguage());
                env.put("country", imdbInfo.getCountry());
                env.put("director", imdbInfo.getDirector());
                env.put("genres", imdbInfo.getGenres());
                env.put("plot", imdbInfo.getPlot());
                env.put("rating", imdbInfo.getRating() != null ? imdbInfo.getRating() / 10 + "." + imdbInfo.getRating() % 10 : "0");
                env.put("votes", imdbInfo.getVotes() != null ? imdbInfo.getVotes() : "0");
                env.put("url", imdbInfo.getURL());
                env.put("runtime", imdbInfo.getRuntime() != null ? imdbInfo.getRuntime() : "0");
                String imdbDirName = container.getSession().jprintf(bundle, "imdb.dir", env, container.getUser());
                try {
                    container.getElements().add(new LightRemoteInode(imdbDirName, "drftpd", "drftpd",
                            IMDBConfig.getInstance().barAsDirectory(), dir.lastModified(), 0L));
                } catch (FileNotFoundException e) {
                    // dir was deleted during list operation
                }
            }
        }
    }
    return container;
}
 
Example #30
Source File: ConfigFiller.java    From sqoop-on-spark with Apache License 2.0 5 votes vote down vote up
private static boolean fillInputLong(MLongInput input, ConsoleReader reader, ResourceBundle bundle) throws IOException {
  generatePrompt(reader, bundle, input);

  if (!input.isEmpty() && !input.isSensitive()) {
    reader.putString(input.getValue().toString());
  }

  // Get the data
  String userTyped;
  if (input.isSensitive()) {
    userTyped = reader.readLine('*');
  } else {
    userTyped = reader.readLine();
  }

  if (userTyped == null) {
    return false;
  } else if (userTyped.isEmpty()) {
    input.setEmpty();
  } else {
    Long value;
    try {
      value = Long.valueOf(userTyped);
      input.setValue(value);
    } catch (NumberFormatException ex) {
      errorMessage("Input is not a valid long");
      return fillInputLong(input, reader, bundle);
    }

    input.setValue(Long.valueOf(userTyped));
  }

  return true;
}