POEdit: Can't update translations from Source Code - razor

I am using POEdit for translations in a web application.
However, when I start POEdit I can't find any sources when I run 'Catalog > Update from Sources'. I only have .CSHTML-Files where the texts need to be translated.
What I've already tried:
Set the source path in Catalog > Properties and the charset to
'UTF-8'.
Added additional keyword ("[[[w+]]]") for matching words in my files (the words to translate always have the following form: [[[wordToTranslate]]]
Added a cshtml-extractor (In File > Settings > Extractor). When I did this, the following error message appeared: "warning: unterminated string constant". Warning: ')' found where '}' was expected.
Browsing the web without finding any clue of how to include cshtml-files.
Any hints are appreciated.
Any solutions are MUCH appreciated. :-)

Added additional keyword ("[[[w+]]]") for matching words in my files
I don’t know why you assume the keyword values are regexes of all things; they are not. The GNU gettext manual makes it clear what “keyword” is in the gettext context: name of the function used to call gettext with translatable string literals as the argument.
Added a cshtml-extractor
You get errors coming from this, it would be reasonable to assume that’s the problem. Because you gloss over this crucial step and don’t reveal the details of how you configured it, it’s impossible to give you a concrete answer (not without a crystal ball, anyway).
So I can only make an educated guess: if you didn’t actually add a proper extractor that understands the syntax of the template language you use, and used some gross hack like using the Python parser, then that’s the cause of your errors, together with the use of keyword value that can’t possibly be valid.

Related

How to convince VS code to accept # as comment in JSON files?

We have special files that contain JSON data mixed with # comments.
I figured I need to enhance Code's json.settings file with:
"files.associations": {
"*.ourextension": "jsonc"
}
but then I discovered that jsconc is about JSON data with // comments.
Is there a convenient way to get VS code to accept # comments in JSON data?
Edit: VS code recognizes the jsconc language, it gives me this error message:
And it also accepts // comments:
adding the // got me a green first line, and now the second line gets the first error (because starting with #).
If you use the Change Language mode command (or click on the language indicator on the status bar) you can select "jsonc JSON with Comments".
I think this is only auto-detected when the extension is .jsonc.
NB. JSON with comments uses JavaScript style single line comments: from a \\, outside a string literal, to the end of line.
To support some different comment indicator would require a new language mode (and an extension to add it).
A distinct non-answer: it might be possible to add a such a new language definition, but it would require quite a bit of work. I also had a quick look if I could simply change the corresponding config json file for jsonc that ships with VS code, but that file is rather complex, and would probably be overridden with the next VS code update.
Thus a straight forward workaround. Two scripts to replace one command style with the other:
#!/bin/sh
# a helper script that turns all # into //
# with the syntax that works for sed on MAC OS
for file in "$#"
do
sed -i '' -e 's,#,//,g' $file
done
Not exactly convenient, but fast and robust, given our specific requirements.

the use of `%3F` in URL

While moving a website - that I did not build - I have run into the use of %3F.
%3F is the percent-encoded version of ?.
It seems to be used like this a lot:
Example
when linking to a file named example_lang=1.html.
So, I replaced %3F with _, and all works again.
I am missing something here. The old website worked. After being moved, it no longer worked. After the replacement of %3F to _, the links worked again. Why?
First, you should elaborate your question to understand it better after all If I understood it correctly then this might be the answer.
"_" is not a reserved URI character.
As you said that %3F is reserved for "?" then you are absolutely right but if you read the documentation written on wiki states that "_"(underscore) is not a reserved URI character.
So that for example if the URL for a web page is "example_test.html" then its encoded URL must be "example_test.html" if there is not any mechanism applied on that URL. Now I will take an another example of PHP based web page that may answer your question.
In PHP there is a function "str_replace" that is used to replace the string by programmer defined characters or string.
Let assume that I have a page named "example_test.html" and for some xyz reasons I want to change it to "example%3Ftest.html" then I can use
str_replace("%3F","_","<a href='example%3Ftest.html'>Example Test</a>");
This function will search for all occurences of "%3F" and replace it with "_" in provided string(here "href=example%3Ftest.html") and output as "href='example_test.html" which is the actual link for my file.

SSRS - Action Go To Url escape special characters

I'm using SSRS Action -> Go To Url like this:
="javascript:void(window.open('http://xxx/xxx/Pages/ReportViewer.aspx?%2fDevelopment%2fReport&rs:Command=Render&Parameter="& Parameters!Parameter.Value &"'))"
generated link should be:
http://xxx/xx/Pages/ReportViewer.aspx?/Development/Report&rs:Command=Render&Parameter=Úxxx
I need to somehow escape special characters with diacritics like character 'Ú' in example above. Without escaping this character the above link is broken.
Thanks for you help.
You need to URL encode your parameter, however referencing System.Web (as many suggest) is problematic, since later versions of the Reporting Services designer seem to run in a partial trust context, and System.Web does not have APTCA.
Instead, in later framework versions you have the choice of using System.Uri.EscapeDataString or System.Net.WebUtility
See SO question How do you UrlEncode without using System.Web? for examples of both, neither of which require full trust
You need to add Url encoding to your outgoing parameters. This article explains how to reference the library in the report and user UrlEncode() to process your parameters.

Where is the "foo" path in file system api?

I want to make a APP based on Chrome offline to do local file write and read.
I tried to understand how the File System API work.
My question is where the "foo" path really is in windows 7?
HERE is the W3's documentary about the path.
I tried the example supplied by W3, and are there any other simple examples?
Any hint will be appreciated.
foo is a meta-variable, it's not an actual real thing, rather just something to use as a place-holder.
It's similar to things like /path/to/file which doesn't mean you need a literal hierarchy containing those directories, rather it means substitute in the real path to your file.
foo, bar, baz are all common, I also use xyzzy, plugh and twisty due to rather large amounts of my youth being wasted on text adventure games :-)
All that the W3C document is saying with a comment like:
Thus 'foo/./bar' is equivalent to 'foo/bar', and './foo' is equivalent to 'foo'.
is that ./ can be effectively removed from the path string if it's at the front or immediately following a /. This is true regardless of the actual path components you use in place of foo and bar.
foo and bar are typically used as placeholder terms when explaining something that relies on user defined names. It is used when the name can be something arbitrary.

Escape Html in erlang

Does anyone have a good way to escape html tags in erlang (as for CGI.escapeHtml in Ruby)?
Thanks
Well, i would tell you to roll your own method using string and list processing But, i would also say that if you have yaws web server source, there is a method i have used and copied into my own libraries. yaws_api:url_encode(HtmlString). See it here in action.
1> Html = "5 > 4 = true".
"5 > 4 = true"
2> yaws_api:url_encode(Html).
"5%20%3E%204%20%3D%20true"
3>
I hope this is some how what u needed. If this is what you needed, you could just browse yaws web server source code and then copy out this function and use it in your own projects, notice that within the module yaws_api.erl, you will have to make sure that you copy out all the dependencies for this function as klacke did a lot of pattern matching, function clauses, recursion e.t.c. Just copy the whole function and the small support functions from that source file and paste it some where in your projects. The other way would be to do it by your own by manipulating strings and Lists. Those are my suggestions :)