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

hard-coded match strings make this project language dependent #115

Open
harttle opened this issue Jul 13, 2017 · 4 comments
Open

hard-coded match strings make this project language dependent #115

harttle opened this issue Jul 13, 2017 · 4 comments

Comments

@harttle
Copy link

harttle commented Jul 13, 2017

I'm trying to translate whatwg/html here: https://whatwg-cn.github.io/html/multipage/

To sync this fork (especially not-yet-translated sections), the build tools (html-build, watssi) are also used in that repo. While I find out the hard coded match strings (in .pre-process-annotate-attributes.pl, .pre-process-tag-omission.pl, and maybe others) will break the build process, for example:

<dt><span data-x=\"concept-element-attributes\">Content attributes</span>:</dt>

https://github.com/whatwg/html-build/blob/master/.pre-process-annotate-attributes.pl#L18

Now I also translated these perl source files locally. Could there be better solutions to make this tool language in-dependent? Or should I push the zh-Hans version to this project, which may require localization mechanism to be implemented.

@harttle harttle changed the title hard-coded match strings makes this project language dependent hard-coded match strings make this project language dependent Jul 13, 2017
@domenic
Copy link
Member

domenic commented Jul 13, 2017

It seems like a worthy goal to make this language-independent. My preferred approach would be changing these parts of the script to search based on langauge-independent things, e.g. the data-x value instead of the data-x + text content. A pull request to do that would be welcome.

@harttle
Copy link
Author

harttle commented Jul 14, 2017

Agreed. But this only works if there're enough markups or annotations in the html/source firstly, and not to insert any text (this will be language specific) when building. Like these:

# in file .pre-process-tag-omission.pl:
$$line .= "   <dt><span data-x=\"concept-element-tag-omission\">Tag omission in text/html</span>:</dt>\n";
# and:
pushLine($_, "  <p>Neither tag is omissible.</p>\n");

By the way, I don't think it's a good idea to maintain semantic-related parts of source in build scripts. I mean, like .pre-process-tag-ommision.pl. It's feasible as long as this part do not change frequently. If that's OK, I can help.

@domenic
Copy link
Member

domenic commented Jul 14, 2017

Hmm, I see.

I think it's important that we not repeat this boilerplate in the source file. Do you have a proposed solution that allows us to keep the source file clean, but still allows easier translation?

@harttle
Copy link
Author

harttle commented Jul 15, 2017

We can keep the source untouched by providing a i18n configuration (maybe picked up by a LANG env variable) for the build tools.

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

No branches or pull requests

2 participants