ngx-rocket / generator-ngx-rocket

:rocket: Extensible Angular 14+ enterprise-grade project generator
https://ngx-rocket.github.io/
MIT License
1.53k stars 216 forks source link

feat: Local language name for bootstrap and Material (language selector component) #589

Closed fabiomartino closed 10 months ago

fabiomartino commented 3 years ago

Hi all

I just added a enum with the language code and is corresponding language name I made it only for Bootstrap and Material.

Probably there is a better way to add it to the enum... a for loop like

<% for (let lang of props.languages) { -%>

instead of fill the enum with all the cases as I did...

<% if (props.ui === 'bootstrap' || props.ui === 'material') { -%>
// Local language name
enum ELanguages {
  'de-DE' = 'Deutsche',
  'en-US' = 'English',
  'es-ES' = 'Español', // Castellano
  'fr-FR' = 'Française',
  'it-IT' = 'Italiano',
  'pt-BR' = 'pt-BR', // Português do Brasil
  'zh-CN' = 'zh-CN' // 简体中文
}
<% } -%>

Screenshot_05

Cordially Fabio

sinedied commented 3 years ago

Sorry for the lack of feedback, I missed this one :(

Thanks for the proposal, but I would prefer to keep the base project as simple as possible regarding i18n, as such as enum would depend of which language option is included, and depending of the project you may want different things (like using a flag or something else).

This is interesting though, I'm wondering if that would be useful to add a "recipes" docs folder for small additions like this one, for anyone who would be interested to add it to its project? Any thoughts?