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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

OSGI Config

arvind
Level 4
Level 4

Hi Team,

 

We are managing multilingual site. and need to manage different configuration values based on language site, meaning that we need one configuration per language site.

 

How we can manage to load specific configuration based on language or any property values inside configuration as input ?

 

Regards,

AP

 

 

1 Accepted Solution
BrianKasingli
Correct answer by
Community Advisor
Community Advisor

@arvind ,

for your scenario, I suggest using Apache Sling Context-Aware Configuration

BrianKasingli_0-1625442037236.png

The application needs different configuration for different sites, regions and tenants = different contexts. Some parameters may be shared, so inheritance for nested contexts and from global fallback values is supported as well. You have full control which content subtrees are the contexts in your application, the structure above is only an example.

Using the Context-Aware Configuration Java API you can get the matching configuration for each content resource without caring where it is stored or how the inheritance works.

full documentation can be found here: https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configurati...

 

-------------------------------------------------------

However, if you really wanted to use OSGI configurations, then what you can do is to create your OSGI configuration with your language variations, for example:

  • eng.subscriptionApiKey
  • fr.subscriptionApiKey

And then using AEM backend, to detect the language from the SlingHttpServletRequest object, and either output eng.subscriptionApiKey or fr.subscriptionApiKey.

View solution in original post

2 Replies
BrianKasingli
Correct answer by
Community Advisor
Community Advisor

@arvind ,

for your scenario, I suggest using Apache Sling Context-Aware Configuration

BrianKasingli_0-1625442037236.png

The application needs different configuration for different sites, regions and tenants = different contexts. Some parameters may be shared, so inheritance for nested contexts and from global fallback values is supported as well. You have full control which content subtrees are the contexts in your application, the structure above is only an example.

Using the Context-Aware Configuration Java API you can get the matching configuration for each content resource without caring where it is stored or how the inheritance works.

full documentation can be found here: https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configurati...

 

-------------------------------------------------------

However, if you really wanted to use OSGI configurations, then what you can do is to create your OSGI configuration with your language variations, for example:

  • eng.subscriptionApiKey
  • fr.subscriptionApiKey

And then using AEM backend, to detect the language from the SlingHttpServletRequest object, and either output eng.subscriptionApiKey or fr.subscriptionApiKey.

View solution in original post

Dipti_Chauhan
Community Advisor
Community Advisor

Hi @arvind 

  Agree with @BrianKasingli  .In your case there is no need to create OSGi for country level and language level .In your case configuration are based on content hierarchy. so you should go ahead with Context-Aware Configuration

 

Thanks

Dipti