Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

need i18n values in model class from dialog node

khalidMomin
Level 4
Level 4

Hi All,

I am trying to fetch the i18n values passed via dialog to model class.

But i am not able to get the same.

here is my dialog nodes:

<suffix-title-business
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/hidden"
   allowBulkEdit="{Boolean}true"
   ignoreData="{Boolean}true"
   name="./businessAffix"
   value="page.title.business.affix"/>

<suffix-title-personal
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/hidden"
   allowBulkEdit="{Boolean}true"
   ignoreData="{Boolean}true"
   name="./personalAffix"
   value="page.title.personal.affix"/>

here is the code in my model class:

@Inject @Optional
private  String personalAffix;

@Inject @Optional
private  String businessAffix;

I am not able to get the value in model class.

Please help.

1 Accepted Solution
khalidMomin
Correct answer by
Level 4
Level 4

I resolved it. Maybe useful for others.

@Model(adaptables = SlingHttpServletRequest.class)

public class MyModel {  

    @Self

    SlingHttpServletRequest request;

  private I18n i18n;

  if (request != null) {

        i18n=new I18n(request);

  business=i18n.getVar("page.title.business.affix");

  }

}

View solution in original post

0 Replies
khalidMomin
Correct answer by
Level 4
Level 4

I resolved it. Maybe useful for others.

@Model(adaptables = SlingHttpServletRequest.class)

public class MyModel {  

    @Self

    SlingHttpServletRequest request;

  private I18n i18n;

  if (request != null) {

        i18n=new I18n(request);

  business=i18n.getVar("page.title.business.affix");

  }

}

View solution in original post