Kahla | The server side , home page , bot and SDK repo for Kahla | Runtime Evironment library
kandi X-RAY | Kahla Summary
kandi X-RAY | Kahla Summary
The server side, home page, bot and SDK repo for Kahla.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Kahla
Kahla Key Features
Kahla Examples and Code Snippets
Community Discussions
Trending Discussions on Kahla
QUESTION
We are developing an app with Angular 8.2. This question is not related to AngularJs.
ProblemI have read the Angular localization document here: https://angular.io/guide/i18n
But it seems that localization was done in the building process. After the app is built, it can't be changed. So how can we build an Angular app which supports language switching without the internet?
CDNOur app is deployed behind CDN. The CDN servers reverse-proxy the HTML, JavaScript and CSS files and will cache all files passed. The server-side app language switching is not available.
Electron editionAnd we have provided a client-side app based on the electron. We need to deliver the app once and the user can switch between different languages without the internet. But I have found no solution to it.
Domain nameYou may mention that we can switch language via the switching the domain. But for CORS reason, our client-side app domain name is limited and can not be switched. So only one domain name is available.
Google Play StoreAnd we have built and published our app to the Google Play Store via TWA. The domain was registered with the app. Switching domains also cause downloading the app from Store again.
Addition infoAnd the source code of the app is here: https://github.com/AiursoftWeb/Kahla.App
Just for possible additional info. Don't have to check it for answering this question.
...ANSWER
Answered 2020-Feb-06 at 12:26We've faced similar requirements in past and that's why I created a blog post about translations in Angular as a code (without libs just your code and project architecture).
https://medium.com/angular-in-depth/angular-typed-translations-29353f0a60bc
To answer all of the challenges:
CDN:
- language mutation is on the route level (not domain)
domain.com/language/page
domain.com
may include some redirect logic- for example, redirect to default language or determine it (we have a cloud function there that does that based on the browser request language preferences
Electron:
- Translations are present on the build time
- Modules containing different i18n data are shipped with the app and lazyloaded when needed (but available for the electron instantly as it is bundled together)
Domain:
- again, language is switched using "route" not domain
- example:
domain.com/en/contact
for Englishdomain.com/cs/contact
for Czech
- example:
- it is great not only because of cors but also because of SEO and Crawlers
- the most relevant part of the route comes first (language)
Google Play Store:
- same as with electron, it is bundled together
- uses routing not domain
Even if you decide not going with the "route" based switching, you may store the translations in your state management or wrapping service and access them as you would do with any other "async" data in the template via async
pipe
3rd Party: Some other solutions involving 3rd party libs are ngx-translate (deprecated) and Transloco
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Kahla
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page