theLee3 / flutter_auto_translator

A command-line tool to translate ARB files.
BSD 3-Clause "New" or "Revised" License
8 stars 5 forks source link

Space after placeholder is removed #4

Closed orkun1675 closed 8 months ago

orkun1675 commented 8 months ago

Thank you for the awesome package! It has saved me a great amount of time.

English entry:

  "youFinished": "You finished {artwork}",
  "@youFinished": {
    "placeholders": {
      "artwork": {
        "type": "String",
        "example": "Mona Lisa"
      }
    }
  },

when translated to Turkish (TR) becomes:

    "youFinished": "{artwork}bitirdiniz",

while it should be: {artwork} bitirdiniz or ideally {artwork}'yi bitirdiniz

In Turkish the noun is moved to the beginning of the sentence. I'm guessing because in the original message there is no space after the placeholder the translated message has the space incorrectly removed?

theLee3 commented 8 months ago

I'm glad you have found the package helpful @orkun1675, and thank you for the feedback.

Your theory is likely correct. I imagine the placeholder moving from the end of the sentence is an edge case that causes the missing space. I will implement a fix shortly. Hopefully, there is an approach that will reach the ideal translation, but some results are limited by cloud translate.

I will also have to check to see how punctuation affects this issue.

Having reread your comment, yes you are absolutely correct. The package removes added whitespace and this case needs to be accounted for. Fix incoming shortly.

theLee3 commented 8 months ago

Update 2.0.1 no longer removes the added whitespace. Please pull from GitHub for now.

auto_translator:
    git:
      url: https://github.com/theLee3/flutter_auto_translator

I am leaving this open as I have devised a solution to make it more accurate in circumstances like this, i.e. to ensure {artwork}'yi bitirdiniz in this scenario.

theLee3 commented 8 months ago

As of 2.1.0 translations use placeholder examples when available.

Please let me know how it works for you after pulling from GitHub. I will update on pub.dev if you have no issues.

orkun1675 commented 8 months ago

I deleted the TR translation file and re-generated it. Works like a charm. Thanks @theLee3 !

theLee3 commented 8 months ago

Awesome! Thanks for your help @orkun1675.

Update 2.1.0 is now available via pub.dev