Open alvarotrigo opened 6 years ago
Thanks for reporting. I will look into it soon. By the way, if it can help you contributing I'm perfectly fine switching to plain JS instead of CoffeeScript.
By the way, if it can help you contributing I'm perfectly fine switching to plain JS instead of CoffeeScript.
How did you know I work with plain JS? :D Yeah, I never used coffescript before
How did you know I work with plain JS? :D
Your profile spoke for itself 😄 CoffeeScript kind of made sense when I started the project years ago, but not really anymore. Hopefully it should not be too hard to transform this to JS. Unless this and the other issues you raised are urgent, let's start by transforming this to JS before fixing the rest.
Hopefully it should not be too hard to transform this to JS.
The node module is already generated in .js. So we can just take that as the base?
The node module is already generated in .js. So we can just take that as the base?
Yes, the code is not really pretty so it will need a bit of work, but it is more or less usable.
I finished changing everything to JS and published a beta version to npm. It worked with my projects, but it would be great if you could give it a try, thanks.
Concerning this issue, you can already run static-i18n
on a single file by using the --files
options, for example
static-i18n -l en -i en -i fr --files 'index.html' .
If you want to configure the output path, you can use --output-dir
as follow:
static-i18n -l en -i en -i fr www --output-dir .
Let me know if any of these option would work for your use case.
This is not working for me:
static-i18n -l en -i en -i es -i ru -i ko -i zh --fileFormat yml --allowHtml true --files 'demo.html'
I'm getting:
usage: static-i18n [options] directory
Ok, I had to add the .
at the end
static-i18n -l en -i en -i es -i ru -i ko -i zh --fileFormat yml --allowHtml true --files 'demo.html' .
I'm using a file within a folder, so 'www/demo.html' .
ends up creating i18n/es/www/demo.html
instead of i18n/es/demo.html
.
I tried using the --output-dir .
param, but I get
usage: static-i18n [options] directory
With
static-i18n -l en -i en -i es -i ru -i ko -i zh --fileFormat yml --allowHtml true --files 'www/demo.html' --output-dir .
If your files are in the current directory, your first command is correct, but if they are in the www
directory, it should be
static-i18n -l en -i en -i es -i ru -i ko -i zh --fileFormat yml --allowHtml true --files 'demo.html' www
For your second command, you are missing the input directory, as the final .
is interpreted as the output directory. If you want to use the files in www
as input, just append www
to your last command.
static-i18n -l en -i en -i es -i ru -i ko -i zh --fileFormat yml --allowHtml true --files 'demo.html' --output-dir . www
It would be great if we could apply the
static-i18n
command to a single file instead of to a folder.I personally have my
index.html
file in the root path, and I would prefer to keep it that way because that's gonna be the structure in my hosting.Right now I'm forced to place it within a folder so
static-i18n
can work over it, therefore messing my relative paths when outputing the result in a 2 levels depth path.From
./www/index.html
toi18n/es/index.html
.The other option would be to be able to configure the output path, so instead of having
i18n/es/index.html
we could havees/index.html
and therefore solving the relative paths issue.