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

Keeping same source in all translation #42

Closed
item4 opened this issue Dec 14, 2015 · 4 comments
Closed

Keeping same source in all translation #42

item4 opened this issue Dec 14, 2015 · 4 comments

Comments

@item4
Copy link
Contributor

item4 commented Dec 14, 2015

Some PR update only some lang translation.

I think all source source code must be same.

How do you think about building readme with some script and seperated translation files?

For example..

// en.js
{
util: {
title: "Utilities",
description: "",
contents: {
  isArray: { title: "isArray", description: "" }
}
...
}

and

// isArray.js
// jQuery
$.isArray(range);

// Native
Array.isArray(range);
@camsong
Copy link
Owner

camsong commented Dec 14, 2015

Nice idea to find a way to keep them sync automatically.
But this can be tough, firstly we should try to keep the docs easy maintain. Right now markdown is easy.

@item4 Your JS way are not easy enough, but still a good start, we should investigate on this further.

@item4
Copy link
Contributor Author

item4 commented Dec 14, 2015

We can check diff by travis-ci.

First, grep source code part and get count of each source part. If they have some difference, it was broken.

How about this?

@idiotWu
Copy link
Contributor

idiotWu commented Dec 15, 2015

How about keep code source in js files and using some directives to insert them? For example:

In markdown:

#### code example:
```javascript
{{include 'src/a.js'}}
```

In build tools:

source.replace(/\{{2}include (['"])([^\1]+)\1\}{2}/g, (match, quote, src) => fs.readFileSync(src).toString());

In my view this will also be helpful for further testing :)

@Chocanto
Copy link
Contributor

Chocanto commented Jan 6, 2016

Some source code have comments that need to be translated. If you want to include them, it will not be possible to get internationalized comments (well... in reality, source code is a lot of time in English).

@camsong camsong closed this as completed Aug 5, 2016
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

4 participants