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

CLI does not extract all messages after 2.2.0 update #244

Closed
queicherius opened this issue Jul 13, 2018 · 7 comments
Closed

CLI does not extract all messages after 2.2.0 update #244

queicherius opened this issue Jul 13, 2018 · 7 comments

Comments

@queicherius
Copy link
Contributor

queicherius commented Jul 13, 2018

lingui/cli at 2.1.0

┌─────────────┬─────────────┬─────────┐
│ Language    │ Total count │ Missing │
├─────────────┼─────────────┼─────────┤
│ de          │     471     │   104   │
│ en (source) │     471     │    -    │
│ es          │     471     │   471   │
│ fr          │     471     │   30    │
└─────────────┴─────────────┴─────────┘

lingu/cli at 2.2.0

┌─────────────┬─────────────┬─────────┐
│ Language    │ Total count │ Missing │
├─────────────┼─────────────┼─────────┤
│ de          │     457     │   90    │
│ en (source) │     457     │    -    │
│ es          │     457     │   457   │
│ fr          │     457     │   16    │
└─────────────┴─────────────┴─────────┘

It seems like all of the messages that disappear are in the same top-level folder (common/LoadingIndicator/LoadingIndicator.js), even tho there is nothing that differentiates them from the other messages in other top-level folders (pages/Contributors/index.js). Here is one file that disappeared out of the messages, as an example:

import React, {Component} from 'react'
import {Trans} from '@lingui/react'

class LoadingIndicator extends Component {
  render () {
    return (
      <div>
          <div>
            <Trans>Loading...</Trans>
          </div>
      </div>
    )
  }
}

export default LoadingIndicator
@tricoder42
Copy link
Contributor

Hey @queicherius,
I'm looking into it. It works fine for the example project in both versions. I tried the same file at the same location, but it worked fine (but I discovered another bug #245).

  • What lingui config do you use?
  • What babel config do you use?

Anything these 24 messages have in common? Or the files?

@queicherius
Copy link
Contributor Author

What lingui config do you use?

  "lingui": {
    "sourceLocale": "en",
    "localeDir": "<rootDir>/src/translations/current",
    "srcPathDirs": [
      "<rootDir>/src/newSrc"
    ],
    "format": "minimal"
  },

What babel config do you use?

{
  "presets": [
    ["env", {"targets": {"browsers": [">0.25%, not ie 11, not op_mini all"]}, "loose": true}],
    "react",
    "stage-1",
    "@lingui/babel-preset-react"
  ],
  "plugins": [
    ["angularjs-annotate"]
  ]
}

Anything these 24 messages have in common? Or the files?

These are the messages:

  • and
  • Become one here!
  • in {time}
  • Loading...
  • now
  • Page<0>{0,number}</0>of<1>{totalPages,number}</1>
  • {time} ago
  • {v, plural, one {hour} other {hours}}
  • {v, plural, one {minute} other {minutes}}
  • {v, plural, one {month} other {months}}
  • {v, plural, one {second} other {seconds}}
  • {v, plural, one {week} other {weeks}}
  • {v, plural, one {year} other {years}}
  • {v, plural, one {day} other {days}}

The usage of the translation is pretty different as well:

  • <Trans>Loading...</Trans>
  • <Trans>Page<strong><NumberFormat value={props.currentPage + 1} /></strong> of <strong><NumberFormat value={totalPages} /></strong></Trans>
  • i18n.plural({value: v, one: 'year', other: 'years'})
  • i18n._('{time} ago', {time: stringParts.join(' ')})

The files themselves have nothing to do with each other than being in the same directory, at least as far as I can tell.

@tricoder42
Copy link
Contributor

Do you run lingui extract with --clean option?

There was a bug in previous version, that messages from removed files weren't marked as obsolete. I assume there's no e.g. Loading... message in new catalog at all, right?

@queicherius
Copy link
Contributor Author

Do you run lingui extract with --clean option?

Yes

There was a bug in previous version, that messages from removed files weren't marked as obsolete. I assume there's no e.g. Loading... message in new catalog at all, right?

No, it's completely gone in the new catalog after I run lingui extract --clean, even tho the file is still there and in use.

@tricoder42
Copy link
Contributor

Thanks! I found that locale/_build directory isn't cleaned properly. Just to be 100% sure, could you please remove it (in your case <rootDir>/src/translations/current/_build) and run extract again?

If it won't fix the problem, let's try this:

  1. Install @lingui/cli@~2.1.0
  2. Change format to lingui
  3. Run lingui extract
  4. Install @lingui/cli@~2.2.0
  5. Run lingui extract
  6. Check if Loading... is there and if so, if it has obsolete: true flag.

I'm trying to figure out if the bug is caused by extract plugin or the CLI itself.

@tricoder42
Copy link
Contributor

@queicherius I've got something! I managed to reproduce the bug locally. Now trying to figure out the root cause. Feel free to skip the instructions from the last message. Also, I'm on gitter now if you want to talk about it. Cheers 👍

@tricoder42
Copy link
Contributor

Fixed in latest release v2.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants