Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#181 add multi language to hard skills label #193

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
/>
</svg>
<div>
<h3>HARD SKILLS</h3>
<h3>
<%- labels.HARD_SKILLS_HEADING %>
</h3>
<hr class="secondary-divider" />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import ejs from 'ejs';
import { ManfredAwesomicCV } from '@/model';
import { HardSkillVM, mapFromCvToHardSkillVm } from '@lemoncode/manfred-common/hard-skill-section';
import hardSkillsSection from './hard-skills-section.ejs?raw';
import hardSkillsTemplate from './hard-skills-section.ejs?raw';
import { Language } from '@lemoncode/manfred-common/model';
import { englishHardSkillsLabels, spanishHardSkillsLabels } from './labels';

export const generateHardSkillsSection = (cv: ManfredAwesomicCV): string => {
export const generateHardSkillsSection = (cv: ManfredAwesomicCV, language: Language = 'es'): string => {
const hardSkillsSectionVm = mapFromCvToHardSkillVm(cv);
return generateHardSkillsSectionInner(hardSkillsSectionVm);
return generateHardSkillsSectionInner(hardSkillsSectionVm, 'es');
};

const generateHardSkillsSectionInner = (hardSkillsSectionVm: HardSkillVM[]): string => {
const generateHardSkillsSectionInner = (hardSkillsSectionVm: HardSkillVM[], language: Language): string => {
const rootObject = {
hardSkillsCollection: hardSkillsSectionVm,
labels: !language || language === 'es' ? spanishHardSkillsLabels : englishHardSkillsLabels,
};
return ejs.render(hardSkillsSection, rootObject);
return ejs.render(hardSkillsTemplate, rootObject);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { HardSkillsLabels } from './hard-skills-label-definition.model';

export const englishHardSkillsLabels: HardSkillsLabels = {
HARD_SKILLS_HEADING: 'Hard Skills',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface HardSkillsLabels {
HARD_SKILLS_HEADING: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { HardSkillsLabels } from './hard-skills-label-definition.model';

export const spanishHardSkillsLabels: HardSkillsLabels = {
HARD_SKILLS_HEADING: 'Competencias',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './hard-skills-english-labels.const';
export * from './hard-skills-spanish-labels.const';
export * from './hard-skills-label-definition.model';
Loading