public String getI18nizedText() { String propertyKey = StringUtil.escapeStringCharacters(getKey()); I18nizedTextGenerator textGenerator = myResourceBundleManager.getI18nizedTextGenerator(); if (textGenerator != null) { return generateText(textGenerator, propertyKey, getPropertiesFile(), myLiteralExpression); } String templateName = getTemplateName(); LOG.assertTrue(templateName != null); FileTemplate template = FileTemplateManager.getInstance(myProject).getCodeTemplate(templateName); Map<String, String> attributes = new THashMap<String, String>(); attributes.put(PROPERTY_KEY_OPTION_KEY, propertyKey); attributes.put(RESOURCE_BUNDLE_OPTION_KEY, getResourceBundleText()); attributes.put(PROPERTY_VALUE_ATTR, StringUtil.escapeStringCharacters(myDefaultPropertyValue)); addAdditionalAttributes(attributes); String text = null; try { text = template.getText(attributes); } catch (IOException e) { LOG.error(e); } return text; }
public String getI18nizedText() { String propertyKey = StringUtil.escapeStringCharacters(getKey()); I18nizedTextGenerator textGenerator = myResourceBundleManager.getI18nizedTextGenerator(); if (textGenerator != null) { return generateText(textGenerator, propertyKey, getPropertiesFile(), myLiteralExpression); } String templateName = getTemplateName(); LOG.assertTrue(templateName != null); FileTemplate template = FileTemplateManager.getInstance().getCodeTemplate(templateName); Map<String, String> attributes = new THashMap<String, String>(); attributes.put(PROPERTY_KEY_OPTION_KEY, propertyKey); attributes.put(RESOURCE_BUNDLE_OPTION_KEY, getResourceBundleText()); attributes.put(PROPERTY_VALUE_ATTR, StringUtil.escapeStringCharacters(myDefaultPropertyValue)); addAdditionalAttributes(attributes); String text = null; try { text = template.getText(attributes); } catch (IOException e) { LOG.error(e); } return text; }
protected String generateText(final I18nizedTextGenerator textGenerator, final String propertyKey, final PropertiesFile propertiesFile, final PsiLiteralExpression literalExpression) { return textGenerator.getI18nizedText(propertyKey, propertiesFile, literalExpression); }