@Override public Locale getLocale() { if (locale == null) { // looks up jcr:language properties to the root, then considers the page name, falls back to system default // we therefore assume the language structure is correctly configured for the site for this to be accurate locale = page.getLanguage(false); } return locale; }
@Override public String getCountry() { if (country == null) { country = page.getLanguage(false).getCountry(); } return country; }
@Override public String getLanguage() { if (language == null) { // uses hyphens to ensure it's hreflang valid language = page.getLanguage(false).toString().replace('_', '-'); } return language; }
@Override public String getLanguage() { return currentPage == null ? Locale.getDefault().toLanguageTag() : currentPage.getLanguage(false).toLanguageTag(); }
private Locale getLocaleFromResource(Resource resource) { final Page page = InjectorUtils.getResourcePage(resource); if (page != null) { return page.getLanguage(false); } return null; }
@Override public void activate() throws Exception { // new in AEM6.3 : getInheritedPageProperties // replaces getInheritedProperties()-method title = getInheritedPageProperties().get(JcrConstants.JCR_TITLE, String.class); // also new in AEM6.3 // shortcut method getLanguage() without parameters locale = getCurrentPage().getLanguage(); }
@PostConstruct protected void initModel() { title = currentPage.getTitle(); if (StringUtils.isBlank(title)) { title = currentPage.getName(); } Tag[] tags = currentPage.getTags(); keywords = new String[tags.length]; int index = 0; for (Tag tag : tags) { keywords[index++] = tag.getTitle(currentPage.getLanguage(false)); } if (currentDesign != null) { String designPath = currentDesign.getPath(); if (!Designer.DEFAULT_DESIGN_PATH.equals(designPath)) { this.designPath = designPath; if (resolver.getResource(designPath + "/static.css") != null) { staticDesignPath = designPath + "/static.css"; } loadFavicons(designPath); } } populateClientlibCategories(); templateName = extractTemplateName(); }