Skip to content

Commit

Permalink
[feature/react-intl] Extract description into messages files (#653)
Browse files Browse the repository at this point in the history
* Extract `description` to messages file as well

* Better error reporting when extracting messages

* Localization messages updated [generated by tooling]
  • Loading branch information
langpavel authored and koistya committed May 17, 2016
1 parent a8fb68a commit 47d5bbb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/messages/_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "header.banner.desc",
"defaultMessage": "Complex web apps made easy",
"message": "",
"description": "Description in header",
"files": [
"src/components/Header/Header.js"
]
Expand All @@ -11,6 +12,7 @@
"id": "header.banner.title",
"defaultMessage": "React",
"message": "",
"description": "Title in page header",
"files": [
"src/components/Header/Header.js"
]
Expand All @@ -19,6 +21,7 @@
"id": "header.brand",
"defaultMessage": "Your Company Brand",
"message": "",
"description": "Brand name displayed in header",
"files": [
"src/components/Header/Header.js"
]
Expand All @@ -27,6 +30,7 @@
"id": "navigation.about",
"defaultMessage": "About",
"message": "",
"description": "About link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -35,6 +39,7 @@
"id": "navigation.contact",
"defaultMessage": "Contact",
"message": "",
"description": "Contact link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -43,6 +48,7 @@
"id": "navigation.login",
"defaultMessage": "Log in",
"message": "",
"description": "Log in link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -51,6 +57,7 @@
"id": "navigation.signup",
"defaultMessage": "Sign up",
"message": "",
"description": "Sign up link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -59,6 +66,7 @@
"id": "navigation.separator.or",
"defaultMessage": "or",
"message": "",
"description": "Last separator in list, lowercase \"or\"",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand Down
8 changes: 8 additions & 0 deletions src/messages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "header.banner.desc",
"defaultMessage": "Complex web apps made easy",
"message": "Komplexní aplikace jednodušše",
"description": "Description in header",
"files": [
"src/components/Header/Header.js"
]
Expand All @@ -11,6 +12,7 @@
"id": "header.banner.title",
"defaultMessage": "React",
"message": "React",
"description": "Title in page header",
"files": [
"src/components/Header/Header.js"
]
Expand All @@ -19,6 +21,7 @@
"id": "header.brand",
"defaultMessage": "Your Company Brand",
"message": "Vaše firma",
"description": "Brand name displayed in header",
"files": [
"src/components/Header/Header.js"
]
Expand All @@ -27,6 +30,7 @@
"id": "navigation.about",
"defaultMessage": "About",
"message": "O nás",
"description": "About link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -35,6 +39,7 @@
"id": "navigation.contact",
"defaultMessage": "Contact",
"message": "Kontakt",
"description": "Contact link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -43,6 +48,7 @@
"id": "navigation.login",
"defaultMessage": "Log in",
"message": "Přihlásit",
"description": "Log in link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -51,6 +57,7 @@
"id": "navigation.signup",
"defaultMessage": "Sign up",
"message": "Registrace",
"description": "Sign up link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -59,6 +66,7 @@
"id": "navigation.separator.or",
"defaultMessage": "or",
"message": "nebo",
"description": "Last separator in list, lowercase \"or\"",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand Down
8 changes: 8 additions & 0 deletions src/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "header.banner.desc",
"defaultMessage": "Complex web apps made easy",
"message": "",
"description": "Description in header",
"files": [
"src/components/Header/Header.js"
]
Expand All @@ -11,6 +12,7 @@
"id": "header.banner.title",
"defaultMessage": "React",
"message": "",
"description": "Title in page header",
"files": [
"src/components/Header/Header.js"
]
Expand All @@ -19,6 +21,7 @@
"id": "header.brand",
"defaultMessage": "Your Company Brand",
"message": "",
"description": "Brand name displayed in header",
"files": [
"src/components/Header/Header.js"
]
Expand All @@ -27,6 +30,7 @@
"id": "navigation.about",
"defaultMessage": "About",
"message": "",
"description": "About link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -35,6 +39,7 @@
"id": "navigation.contact",
"defaultMessage": "Contact",
"message": "",
"description": "Contact link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -43,6 +48,7 @@
"id": "navigation.login",
"defaultMessage": "Log in",
"message": "",
"description": "Log in link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -51,6 +57,7 @@
"id": "navigation.signup",
"defaultMessage": "Sign up",
"message": "",
"description": "Sign up link in header",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand All @@ -59,6 +66,7 @@
"id": "navigation.separator.or",
"defaultMessage": "or",
"message": "",
"description": "Last separator in list, lowercase \"or\"",
"files": [
"src/components/Navigation/Navigation.js"
]
Expand Down
3 changes: 2 additions & 1 deletion tools/extractMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async function mergeToFile(locale, toBuild) {
const newMsg = messages[id];
originalMessages[id] = originalMessages[id] || { id };
const msg = originalMessages[id];
msg.description = newMsg.description || msg.description;
msg.defaultMessage = newMsg.defaultMessage || msg.defaultMessage;
msg.message = msg.message || '';
msg.files = newMsg.files;
Expand Down Expand Up @@ -126,7 +127,7 @@ async function extractMessages({ watch } = {}) {
delete fileToMessages[fileName];
}
} catch (err) {
console.error(`In ${fileName}:\n`, err.codeFrame);
console.error(`extractMessages: In ${fileName}:\n`, err.codeFrame || err);
}
};

Expand Down

0 comments on commit 47d5bbb

Please sign in to comment.