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

Generate a language file from another translated language file #147

Open
hansmaad opened this issue Sep 4, 2019 · 4 comments
Open

Generate a language file from another translated language file #147

hansmaad opened this issue Sep 4, 2019 · 4 comments

Comments

@hansmaad
Copy link

hansmaad commented Sep 4, 2019

Think of the following situation: Development team has written the templates in german language. They translate into English (messages.en.xlf) theirself. For chinese language they want to give messages.zh.xlf to a translator, who translates from EN to ZH.
Is it possible to generate a messages.zh.xlf from the translated messages.en.xlf, so that it has english as source language? If it's not possible with the current tooling, would it be "easy" to implement? Any hints of how this could be done? Can we contribute something? Is there any public API in the lib we could use?

@Blucbo
Copy link

Blucbo commented Nov 19, 2019

@hansmaad Hi. You can copy EN file in messages.zh.xlf and set source-language="en" target-language="zh" give translator and then set source-language="de" target-language="zh"
What is problem?

@hansmaad
Copy link
Author

@Blucbo I have a messages.en.xlf translated from german

  <file source-language="de" target-language="en">
  <body>
     <trans-unit datatype="html">
        <source>Hallo Welt</source>
	<target state="final">Hello World</target>
            ...

If I add chinese as language I'll get

  <file source-language="de" target-language="zh">
  <body>
     <trans-unit datatype="html">
        <source>Hallo Welt</source>
	<target state="new">Hallo Welt</target>
            ...

But what I'd like to have is

  <file source-language="en" target-language="zh">
  <body>
     <trans-unit datatype="html">
        <source>Hello World</source>
	<target state="new">Hello World</target>
            ...

I don't see a way to simply copy some file. I think I had to take the en file and copy each target to the source. My question es if any tooling is available for this task.

@Blucbo
Copy link

Blucbo commented Nov 20, 2019

@hansmaad You should create extra command that run after xliffmerge.
If you using @@id for bind translated word it is simple.
Parse xlif file and find all after it set in value from

      <trans-unit id="anotherPC" datatype="html">
        <source>Hallo Welt</source>
	<target state="final">Hello World</target>
      </trans-unit>

@Blucbo
Copy link

Blucbo commented Jan 15, 2020

@hansmaad Hi. I saw a possible solution. In our company, we use weblate for translators. In Weblate possible change source file for translations. We hosting weblate it is free))

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

No branches or pull requests

2 participants