Skip to content

Commit

Permalink
feat: Copy id to translatio for source locale
Browse files Browse the repository at this point in the history
Closes #141
  • Loading branch information
tricoder42 committed Dec 23, 2017
1 parent c91e6ad commit d6be6be
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/lingui-cli/src/api/formats/lingui.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export default (config: LinguiConfig): CatalogFormat => ({
const obsoleteKeys = R.difference(prevKeys, nextKeys)

// Initialize new catalog with new keys
const newMessages = R.map(
message => ({
translation: "",
const newMessages = R.mapObjIndexed(
(message, key) => ({
translation: config.sourceLocale === locale ? key : "",
...message
}),
R.pick(newKeys, nextCatalog)
Expand Down
5 changes: 5 additions & 0 deletions packages/lingui-cli/src/lingui-extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export default function command(
const catalog = collect(buildDir)
const catalogs = clean(format.merge(catalog))
options.verbose && console.log()
//
// if (config.sourceLocale) {
// const sourceCatalog = catalogs[config.sourceLocale]
// Object.keys(sourceCatalog).forEach
// }

console.log("Writing message catalogues…")
locales
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as React from "react"
import { Trans } from "lingui-react"

class App extends React.Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as React from "react"
import { Trans } from "lingui-react"

class App extends React.Component {
Expand Down
6 changes: 6 additions & 0 deletions packages/lingui-cli/test/fixtures/extract/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"lingui": {
"localeDir": "./locale",
"sourceLocale": "en"
}
}

0 comments on commit d6be6be

Please sign in to comment.