Remove source references comment from .po file - poedit

I want to remove source references comment from .po file that is generated using poeditor.
Exa.
#: controllers/admin/device.php:282
msgid "Error while deleting !!"
msgstr "Error while deleting !!"
I want to remove this #: comments from .po file

I got an answer:
https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html
Check this link and i need to use xgettext with --no-location attribute
If you want it in Windows then refer this link:
https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#gettext-on-windows
And then using CMD and using this command you can acheive this:
xgettext --no-location -o /output-file-path /input-file-path

The following command does not require installing xgettext utility, rather it relies on sed utility that is pre-installed on UNIX-based systems:
sed -i '/#:.*$/d' *.po
On Windows this command can be executed through bash emulators like Git Bash

Related

How to concatenate multiple markdown files in a specific order in Windows

I can easily do this in LINUX using an includes.txt file:
pandoc -s $(cat includes.txt) -o index.html
where includes.txt contains:
file1.md
file3.md
file2.md
The problem is that I now have to do the equivalent in Windows and cannot figure out how to concatenate the Markdown files in the order specified in the includes.txt file and then pass this to Pandoc.
Any help is appreciated.
You could create a file defaults.yaml with the following content:
input-files:
- file1.md
- file3.md
- file2.md
Then call pandoc with pandoc --defaults defaults.yaml ….
After a short research, I found that you can do the equivalent operation in Windows environment using Pandoc.
Download and install Pandoc using the following link. You should select pandoc-2.9.2-windows-x86_64.msi
Pandoc
After successful installation of Pandoc, open powershell to check if the program is successfully installed by running the following command.
pandoc --version
Now, running the provided command from your original post will work in Windows environment.
pandoc -s $(cat includes.txt) -o index.html

macOS How to read Pages/Numbers file in command line?

macOS How to read Pages/Numbers file in command line ?
I have userd 'cat'
cat /Users/administrator/Downloads/test.pages
but get:
????(??#?-QEQEQEQEQEQEQEQE?kYe??Ȍ?"8?,?9A?i;??1]?????=.SE[????Sqs-?,?iY??3]]QEQEQEQEQEQEQEQE??????(??(??(??(??(??(??(??(??(??(??????(??(??(??(??
addtional
I can use cat to watch .md file
Pages/Numbers files are .zip archives of binary files, not text files. In order to read them on the command line, you'll need a special tool, though I don't believe one exists at the moment

ftp appends ^M to .Z file

I am doing ftp in binary mode and downloading some compressed_file.Z but I get compressed_file.Z^M and when I am using dos2unix it creates a new file with ^M removed but still when I try to uncompress it, I get error saying Corrupt Input or its not recognized as tar file etc. If I paste it in my windows machine using filezila, I am able to open it with 7Z. I have also used sed 's/^M$//' compressed_file.dmp.Z^M>compressed_file.dmp.Z but still it is corrupt file. Has someone faced similar issue?
It's likely that it's only your filenames that contains ^M at the end. You could rename them with:
for A in *.Z$'\x0d'; do
mv -i "$A" "${A%?}" # Remove -i to skip confirmation
done
Removing specification of any kind of mode say ASCII or BINARY etc solved my problem.

Why can't Cygwin CVS read the CVS password file in a Ruby/Perl script?

On the Windows command line and cygwin bash I can execute the following without problems:
cvs login
cvs -Q log -N -rVersion_01_00
A ruby script in the same directory contains the following:
`cvs login`;
`cvs -Q log -N -rVersion_01_00`;
When I execute the ruby script on the Windows command line I get the following error:
cvs log: warning: failed to open /cygdrive/c/Documents and Settings/za100744/.cvspass for reading: No such file or directory
If I run the script in a cygwin bash shell I get the same output I would as when I type in the commands manually.
I have no idea as to what is going wrong. The path generated by the Ruby script is wrong since it is a cygwin path but it works correctly directly on the command line. I use cvs that came as part of cygwin:
which cvs
cvs is an external : C:\cygwin\bin\cvs.exe
Ruby is the one-click installer version:
which ruby
/cygdrive/c/Ruby/bin/ruby
It seems like cvs under Ruby can not resolve /cygdrive/c to c: but works OK from the cmdline.
Perl gives me exactly the same problem.
my $str = "cvs -Q log -N -r$cvs_tag|";
open(CVS_STATUS, $str) or die "\n##ERROR##";
It looks like either CVS can't create the file, or your path is wrong. Does the file .cvspass exist? If not, this page suggests you try creating an empty .cvspass file and then run your command. e.g. do
touch ~/.cvspass
If this doesn't help, then the problem is probably path related. There are a few possibilities; $HOME not set correctly, your home dir not matching what's in \etc\passwd, etc. See this tutorial for some troubleshooting steps that should help pin down the problem.
Using a windows native compiled CVS solves the problem. It is not ideal since I have to send a cvs executable with the script for users that has cygwin CVS but its better than nothing.
We had several problems with unix-, mixed- and windows-style paths in cygwin based perl scripts and built-in tools such as rsync. E.g. rsync can't handle wind-style paths. Use the tool "cygpath.exe" to adjust them correctly. Maybe it's the cause.

How can I convert Markdown documents to HTML en masse?

I'm writing some documentation in Markdown, and creating a separate file for each section of the doc. I would like to be able to convert all the files to HTML in one go, but I can't find anyone else who has tried the same thing. I'm on a Mac, so I would think a simple bash script should be able to handle it, but I've never done anything in bash and haven't had any luck. It seems like it should be simple to write something so I could just run:
markdown-batch ./*.markdown
Any ideas?
Use pandoc — it's a commandline tool that lets you convert from one format to another. This tool supports Markdown to HTML and back.
E.g. to generate HTML from Markdown, run:
pandoc -f markdown index.md > index.html
This is how you would do it in Bash.
for i in ./*.markdown; do perl markdown.pl --html4tags $i > $i.html; done;
Of course, you need the Markdown script.
If you have Node.js installed, then you can use the [MdPugToHtml] converter (https://www.npmjs.com/package/md-pug-to-html). It massively converts Markdown to Html. Moreover, it is possible to use Pug templates, but you can use them without templates.
The conversion is performed in the terminal with just one command:
npx md-pug-to-html /home/content
where:
npx is an npm command that installs md-pug-to-html at the first launch, and then launches the md-pug-to-html converter.
/home/content is a directory with your Markdown files. You may have another one.
The converter has various settings and can be used both in the CLI command line and has an API for use in applications.
There is detailed documentation on the MdPugToHtml converter in English and Russian.
You can do this really easily with VS Code. (Well, this is not a command line tool, but proved itself to be super helpful.)
Install the Markdown All In One extension by Yu Zhang
Open the VS Code Command Palette (Ctrl-Shift-P), and select Markdown All In One: Print documents to HTML (select a source folder)
Tip: If you want to make your export portable, you want to change absolute image paths to relative paths by using the following setting in your settings.json (Ctrl-Shift-P -> Preferences: Open Settings (JSON))
"markdown.extension.print.absoluteImgPath": false
In this way, after conversion, just copy all non-markdown files (images) to the destination folder and the HTML pages are portable.
I use this in a .bat file:
#echo off
for %i in (*.txt) python markdown.py "%i"
// using Bash in mac
for i in *.md; do asciidoc $i; done;

Resources