print msgid msgstr from po file to another file - translation

I have a translated .po file. I like to extract msgid and msgstr to another file.. so that i can print it and give it for error checking to another person..
Here i need omit all the strings/newline/whitespace and space characters. i need only lines with msgid and msgstr
example input
**
#: ../src/administration-activity/admin/class_edit.py:56
msgid "Editing a Class"
msgstr "ತರಗತಿನ್ನು ಬದಲಾಯಿಸಲಾಗುತ್ತಿದೆ"
#: ../src/administration-activity/admin/class_edit.py:61
msgid "Editing class: "
msgstr "ಬದಲಾಯಿಲಾಗುತ್ತಿರುವ ತರಗ:"
**
required output
msgid "Editing a Class"
msgstr "ತರಗತಿನ್ನು ಬದಲಾಯಿಸಲಾಗುತ್ತಿದೆ"
msgid "Editing class: "
msgstr "ಬದಲಾಯಿಲಾಗುತ್ತಿರುವ ತರಗ:"

With Eazy Po you use Export Using Template to save the file the way you like. Open the po file, and from the File menu select Export -> Using Template. A Template Editor window will pop up:
In the left pane list right click for a popup menu and select New Template. In New Template dialog define your template name and press Ok.
In the Loop Block text box type the following (or copy & paste):
msgid "%source%"
msgstr "%translation%"
You will notice a sample result in the Result Example pane at the bottom of the window and this result will change instantly as you play with it.
Select Generate & Save button to save the generated file.
For escape characters substitution; see the setting for the other pre built templates.

Related

Sublime Text & Source Tree cannot see FileDiff in files generated using xml.File and fsObject in Excel VBA

We are looking at certain .yml files that store translation of a Rails application. For example, the structure of en.yml is as follows:
en:
blog:
left_navigation:
list_topic: "Blog topics blah blah"
articles:
show:
by_author: "By %{author}"
number:
currency:
format:
separator: "."
delimiter: ","
format: "%u%n"
admin:
blog:
topics:
form:
topic_name: "Topic name"
topic_parent: "Parent topic"
save: "Save"
cancel: "Cancel"
As part of our team's translation procedure, we have translators translate changes in Excel, then reexport the new .yml file via macros. The relevant code is:
...
FilePathAndName = ExportFolder & ExportLang & ".yml"
...
Set xmlFile = fsObject.createtextfile(FilePathAndName, True, True)
maxline = TargetRange.Rows.Count
i = 1
For Each mCell In TargetRange
line = mCell.Value
xmlFile.write line & IIf(i = TargetRange.Rows.Count, vbNullString, vbCrLf)
i = i + 1
Next mCell
xmlFile.Close
...
However, SublimeText cannot see FileDiff when looking at both files together under "Open Folder" interface. Similar, when loaded to Source Tree it says that the 2 files are not identical, but it fails to show the file difference.
We need this file difference to verify that the translations were done with correct syntax. Could somebody help us?
Thanks for your ideas #Odatnurd and #barrowc
The issue comes from the encoding of the second (destination file). Apparently it needed to be UTF-8. So I just resaved this file in Sublime Text with Encoding = UTF-8 and FileDiff worked again.
So a final question is, how do I make xml.File and fsObject in Excel VBA save the file in UTF-8 format?

Adding Language to Cumulocity

We want to add another language to the Cumulocity plattform. We received the *.po file for our UI Version from the support and generated a test translation to check how it works before ordering the translation. We got the info that we can just put the *.po file to an app or a widget and when deployed, the translation should be visible for the whole platform, but that does not seem to work, do we have to set a reference or something somewhere inside of the app or widget to the po file or is there another aspect we should take a look at?
Best Regards
Our Translationfile contains following header for now:
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-Basepath: .\n"
"X-Generator: Poedit 2.2\n"
msgid "\"{{c8y_Dashboard.name}}\" - dashboard"
msgstr "\"{{c8y_Dashboard.name}}\"-往好处说是超脱豁达"
msgid "\"{{c8y_Kpi.label}}\" - data point"
msgstr "\"{{c8y_Kpi.label}}\"-北洋军阀从白走到黑"
[...]
Try to put the po file into a folder "locales" into your plugin and run the build. Here's an example that worked for me: https://bitbucket.org/m2m/cumulocity-ui-plugin-examples/src/bac470cb8149/plugins/weather

How do I make escapes in a .plist file?

I need to set a Usage Description for my location manager in my apps info.plist. I wanted to force a newline with \n, but that just shows as "text text \n\n text text" in my app. Is it possible to force a new line in a plist string?
Use option + Enter (return) buttons to have new line while editing plist.

Is it possible to write shorthand in cakephp 3 translation files?

My src\Locale\pr_IR file is like
msgid "Mobile"
msgstr "موبایل"
msgid "mobile"
msgstr "موبایل"
msgid "MoBiLe"
msgstr "موبایل"
Is it possible to convert this to something like
msgid "Mobile"
msgid "mobile"
msgid "MoBiLe"
msgstr "موبایل"
No it's not, at least not without creating your own PO file parser that would handle such an invalid/non-standard PO format.
See also
Cookbook > Internationalization & Localization > Creating Message Parsers
http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
Multiple "msgid" for an "msgstr" in gettext

saving data with TextEdit

I want to use TextEdit to save data. what I have so far
tell application "TextEdit"
open /Users/UserName/Desktop/save.rtf
end tell
This gives me
"Expected “given”, “in”, “of”, expression, “with”, “without”, other parameter name, etc. but found unknown token."
and highlights the . in .rtf I tried removing the .rtf
but when I compile it it turns into
(open) / Users / username / desktop / (save)
This code gives "The variable Users is not defined."
also if possible can I have TextEdit run in the background without opening a window?
Put quotes around the path and use POSIX file to get a file object for the path:
tell application "TextEdit"
open POSIX file "/Users/UserName/Desktop/save.rtf"
end tell
You can modify the text of a document by changing the text property:
tell application "TextEdit"
set text of document 1 to text of document 1 & "aa"
end tell
It removes all styles in rich text documents. It also inserts the text as 12-point Helvetica in plain text documents, regardless of the default font.
Creating a new rtf file:
tell application "TextEdit"
make new document at beginning with properties {text:"aa"}
close document 1 saving in POSIX file "/tmp/a.rtf"
end tell
printf %s\\n aa | textutil -inputencoding UTF-8 -convert rtf -stdin -output a.rtf

Resources