8000 Added the name attribute to XLIFF 2 documents by javiereguiluz · Pull Request #9302 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Added the name attribute to XLIFF 2 documents #9302

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

Merged
merged 1 commit into from
Feb 21, 2018

Conversation

javiereguiluz
Copy link
Member

This fixes #9287. It's a simple fix because we only display one XLIFF 2 document in the docs.


@Nyholm I'm sure you did the right thing ... but just asking: making the name value the same as source is the best possible solution here? In Symfony's code the source attribute is short (https://github.com/symfony/symfony/pull/26149/files) but in real world it can be super long and super ugly (containing CDATA, etc.) So, don't you think this will be very verbose? Could we make the name value the same as the id attribute instead? If the XLIFF standard forces us to do this, then forget my comment and accept my apologies 😄

@Nyholm
Copy link
Member
Nyholm commented Feb 20, 2018

That is a super valid comment. From symfony/symfony#25758

For backward compatibility I don't expect to see a change to the way the element is used, but for the 1.2 and 2.0 formats to be treated as equivalent it seems the same logic should be applied.

So my answer is simply just: "but we do it in 1.2, that is why I do it in 2.0".

Im not sure what the reasoning were back when 1.2 was made. Im also not sure what would be a good value if the source is super long as you describe. To only use the ID is not really preferred. That does not bring any additional value.

Maybe one could improve the name by somehow slugify and shorten the source into a name?

@javiereguiluz
Copy link
Member Author
javiereguiluz commented Feb 20, 2018

I see, it's because of BC compatibility. Thanks! Maybe we could use: substr(md5($source), -7)

@Nyholm
Copy link
Member
Nyholm commented Feb 20, 2018

I would rather do something like:

$name = $source;
if (strlen($source) > 80)) {
  $name = substr(md5($source), -7); // Why "-7" btw?
}

@javiereguiluz
Copy link
Member Author

Let's merge this "as is" and if we need to change anything in the code, let's discuss about that in a separate issue. Thanks!

@javiereguiluz javiereguiluz merged commit 30ee49e into symfony:master Feb 21, 2018
javiereguiluz added a commit that referenced this pull request Feb 21, 2018
…luz)

This PR was merged into the master branch.

Discussion
----------

Added the name attribute to XLIFF 2 documents

This fixes #9287. It's a simple fix because we only display one XLIFF 2 document in the docs.

-----

@Nyholm I'm sure you did the right thing ... but just asking: making the `name` value the same as `source` is the best possible solution here? In Symfony's code the `source` attribute is short (https://github.com/symfony/symfony/pull/26149/files) but in real world it can be super long and super ugly (containing `CDATA`, etc.) So, don't you think this will be very verbose? Could we make the `name` value the same as the `id` attribute instead? If the XLIFF standard forces us to do this, then forget my comment and accept my apologies 😄

Commits
-------

30ee49e Added the name attribute to XLIFF 2 documents
symfony-splitter pushed a commit to symfony/translation that referenced this pull request Mar 30, 2018
…o long for "name" (Nyholm)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[Translation] XLIFF2: Make sure to trim source if it is too long for "name"

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This PR is a follow-up on @javiereguiluz's comment here: symfony/symfony-docs#9302

This feature was introduced in symfony/symfony#26149

Commits
-------

ca41fecfd9 Make sure to trim source if it is too long
fabpot added a commit to symfony/symfony that referenced this pull request Mar 30, 2018
…o long for "name" (Nyholm)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[Translation] XLIFF2: Make sure to trim source if it is too long for "name"

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This PR is a follow-up on @javiereguiluz's comment here: symfony/symfony-docs#9302

This feature was introduced in #26149

Commits
-------

ca41fec Make sure to trim source if it is too long
SerhiyMytrovtsiy added a commit to SerhiyMytrovtsiy/translation that referenced this pull request Oct 19, 2022
…o long for "name" (Nyholm)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[Translation] XLIFF2: Make sure to trim source if it is too long for "name"

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This PR is a follow-up on @javiereguiluz's comment here: symfony/symfony-docs#9302

This feature was introduced in symfony/symfony#26149

Commits
-------

ca41fecfd9 Make sure to trim source if it is too long
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Added support for the "name" attribute in the XLIFF nodes
3 participants
0