Commit 98e21f0e authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'tc/locale-sagas' into 'master'

Enable localisation in sagas

See merge request !268
parents 7a7f6a6a 1abd6d83
...@@ -343,4 +343,4 @@ EventAdminScreen.propTypes = { ...@@ -343,4 +343,4 @@ EventAdminScreen.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/events/EventAdminScreen')(EventAdminScreen); export default withTranslation('ui/screens/events/EventAdminScreen')(EventAdminScreen);
...@@ -556,4 +556,4 @@ EventScreen.propTypes = { ...@@ -556,4 +556,4 @@ EventScreen.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/events/EventScreen')(EventScreen); export default withTranslation('ui/screens/events/EventScreen')(EventScreen);
...@@ -218,4 +218,4 @@ RegistrationScreen.propTypes = { ...@@ -218,4 +218,4 @@ RegistrationScreen.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/events/RegistrationScreen')(withStandardHeader(RegistrationScreen)); export default withTranslation('ui/screens/events/RegistrationScreen')(withStandardHeader(RegistrationScreen));
...@@ -119,4 +119,4 @@ LoginScreen.propTypes = { ...@@ -119,4 +119,4 @@ LoginScreen.propTypes = {
status: PropTypes.string.isRequired, status: PropTypes.string.isRequired,
}; };
export default withTranslation(['screens/user/LoginScreen'])(LoginScreen); export default withTranslation('ui/screens/login/LoginScreen')(LoginScreen);
...@@ -115,4 +115,4 @@ MemberListScreen.propTypes = { ...@@ -115,4 +115,4 @@ MemberListScreen.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/memberList/MemberListScreen')(MemberListScreen); export default withTranslation('ui/screens/memberList/MemberListScreen')(MemberListScreen);
...@@ -281,4 +281,4 @@ PizzaScreen.defaultProps = { ...@@ -281,4 +281,4 @@ PizzaScreen.defaultProps = {
order: null, order: null,
}; };
export default withTranslation('screens/pizza/PizzaScreen')(withStandardHeader(PizzaScreen)); export default withTranslation('ui/screens/pizza/PizzaScreen')(withStandardHeader(PizzaScreen));
...@@ -73,4 +73,4 @@ AchievementSection.propTypes = { ...@@ -73,4 +73,4 @@ AchievementSection.propTypes = {
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
}; };
export default withTranslation('screens/profile/AchievementSection')(AchievementSection); export default withTranslation('ui/screens/profile/AchievementSection')(AchievementSection);
...@@ -31,4 +31,4 @@ DescriptionSection.propTypes = { ...@@ -31,4 +31,4 @@ DescriptionSection.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/profile/DescriptionSection')(DescriptionSection); export default withTranslation('ui/screens/profile/DescriptionSection')(DescriptionSection);
...@@ -70,4 +70,4 @@ PersonalInfoSection.propTypes = { ...@@ -70,4 +70,4 @@ PersonalInfoSection.propTypes = {
openUrl: PropTypes.func.isRequired, openUrl: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/profile/PersonalInfoSection')(PersonalInfoSection); export default withTranslation('ui/screens/profile/PersonalInfoSection')(PersonalInfoSection);
...@@ -230,4 +230,4 @@ ProfileScreen.propTypes = { ...@@ -230,4 +230,4 @@ ProfileScreen.propTypes = {
goBack: PropTypes.func.isRequired, goBack: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/profile/ProfileScreen')(ProfileScreen); export default withTranslation('ui/screens/profile/ProfileScreen')(ProfileScreen);
...@@ -106,4 +106,4 @@ NotificationsSection.propTypes = { ...@@ -106,4 +106,4 @@ NotificationsSection.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/settings/NotificationsSection')(NotificationsSection); export default withTranslation('ui/screens/settings/NotificationsSection')(NotificationsSection);
...@@ -96,4 +96,4 @@ EventDetailCard.propTypes = { ...@@ -96,4 +96,4 @@ EventDetailCard.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/welcome/EventDetailCard')(EventDetailCard); export default withTranslation('ui/screens/welcome/EventDetailCard')(EventDetailCard);
...@@ -69,7 +69,7 @@ const mapDispatchToFooterProps = { ...@@ -69,7 +69,7 @@ const mapDispatchToFooterProps = {
openCalendar: calendarActions.open, openCalendar: calendarActions.open,
}; };
const FooterComponent = connect(() => ({}), mapDispatchToFooterProps)(withTranslation('screens/welcome/WelcomeScreen')(Footer)); const FooterComponent = connect(() => ({}), mapDispatchToFooterProps)(withTranslation('ui/screens/welcome/WelcomeScreen')(Footer));
class WelcomeScreen extends Component { class WelcomeScreen extends Component {
handleRefresh = () => { handleRefresh = () => {
...@@ -160,4 +160,4 @@ WelcomeScreen.propTypes = { ...@@ -160,4 +160,4 @@ WelcomeScreen.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
export default withTranslation('screens/welcome/WelcomeScreen')(withStandardHeader(WelcomeScreen, true)); export default withTranslation('ui/screens/welcome/WelcomeScreen')(withStandardHeader(WelcomeScreen, true));
...@@ -23,7 +23,8 @@ function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) { ...@@ -23,7 +23,8 @@ function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
}, initDir); }, initDir);
} }
const componentsPath = 'app/ui'; const appPath = 'app';
const options = { const options = {
nsSeparator: false, nsSeparator: false,
keySeparator: false, keySeparator: false,
...@@ -45,12 +46,7 @@ options.lngs.forEach((lang) => { ...@@ -45,12 +46,7 @@ options.lngs.forEach((lang) => {
indexFiles[lang] = []; indexFiles[lang] = [];
}); });
const components = execFileSync('find', [componentsPath]).toString('utf8') const parseAndSaveResource = (f) => {
.split('\n')
.filter(p => p.indexOf('/style') < 0 && p.length > 0)
.filter(p => fs.statSync(p).isFile());
components.forEach((f) => {
options.defaultNs = f.substr(0, 1).toLowerCase() + f.substr(1, f.length - 4); options.defaultNs = f.substr(0, 1).toLowerCase() + f.substr(1, f.length - 4);
const parser = new Parser(options); const parser = new Parser(options);
const content = fs.readFileSync(path.join(f), 'utf-8'); const content = fs.readFileSync(path.join(f), 'utf-8');
...@@ -77,7 +73,13 @@ components.forEach((f) => { ...@@ -77,7 +73,13 @@ components.forEach((f) => {
} }
}); });
}); });
}); };
execFileSync('find', [appPath]).toString('utf8')
.split('\n')
.filter(p => p.indexOf('/style') < 0 && p.indexOf('/assets') < 0 && p.length > 0)
.filter(p => fs.statSync(p).isFile())
.forEach(parseAndSaveResource);
const indexStream = fs.createWriteStream('app/assets/locales/index.js'); const indexStream = fs.createWriteStream('app/assets/locales/index.js');
indexStream.once('open', () => { indexStream.once('open', () => {
...@@ -96,7 +98,7 @@ indexStream.once('open', () => { ...@@ -96,7 +98,7 @@ indexStream.once('open', () => {
const files = indexFiles[lang]; const files = indexFiles[lang];
const langName = lang.toUpperCase(); const langName = lang.toUpperCase();
files.forEach((fileName) => { files.forEach((fileName) => {
const ns = fileName.substring(7); const ns = fileName.substring(4);
indexStream.write(` '${ns}': files['${fileName}${langName}'],\n`); indexStream.write(` '${ns}': files['${fileName}${langName}'],\n`);
}); });
indexStream.write(' },\n'); indexStream.write(' },\n');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment