OSGI Config

Avatar

Avatar
Boost 5
Level 2
arvind
Level 2

Likes

7 likes

Total Posts

34 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Give Back
Ignite 1
Boost 3
Validate 1
View profile

Avatar
Boost 5
Level 2
arvind
Level 2

Likes

7 likes

Total Posts

34 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Give Back
Ignite 1
Boost 3
Validate 1
View profile
arvind
Level 2

04-07-2021

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

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
BrianKasingli
MVP

04-07-2021

@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.

Answers (1)

Answers (1)

Avatar

Avatar
Boost 100
Level 6
Dipti_Chauhan
Level 6

Likes

114 likes

Total Posts

136 posts

Correct reply

40 solutions
Top badges earned
Boost 100
Give Back 10
Affirm 25
Boost 50
Boost 25
View profile

Avatar
Boost 100
Level 6
Dipti_Chauhan
Level 6

Likes

114 likes

Total Posts

136 posts

Correct reply

40 solutions
Top badges earned
Boost 100
Give Back 10
Affirm 25
Boost 50
Boost 25
View profile
Dipti_Chauhan
Level 6

04-07-2021

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