private String assembleCatalog() { Messages messages = messagesSource.getApplicationCatalog(locale); JSONObject catalog = new JSONObject(); for (String key : messages.getKeys()) { if (key.startsWith("private-")) { continue; } String value = messages.get(key); if (value.contains("%")) { continue; } catalog.put(key, value); } StringBuilder builder = new StringBuilder(2000); builder.append("define(").append(catalog.toString(compactJSON)).append(");"); return builder.toString(); } }