Re: Multilingual Support
Posted: 30 Oct 2012 22:18
what parts of this example need to be translated?
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
All parts.eil wrote:what parts of this example need to be translated?
No resource hacking, only Radialix-program for translation "hard coded strings".Filehero wrote:Resource hacking? Can't think of any other way - which indeed put this achievement in the context of celebrating the 1. FCK got the triple.![]()
The red parts:eil wrote:what parts of this example need to be translated?
Don, here a premature question (since I am curious):admin wrote:<2:#> <2:item;~s>
Code: Select all
========================================================================
XYPLORER TRANSLATION GUIDE - 2012-10-31 20:36
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORTANT NOTE TO TRANSLATORS
=============================
Do not start yet with the serious work! This first version is just for
playing. Try something. Look for questions and problems. Give feedback.
Download Test Package
~~~~~~~~~~~~~~~~~~~~~
Download link to "Reference.lng" which you can use together with "Language.ini" for playing:
http://www.xyplorer.com/download/Language.zip
The test "Reference.lng" has two translations right at the beginning just show that it works:
co.0001= OK--- O.K.
co.0002= Cancel--- Abbrechen
Files
~~~~~
- "Language.ini" in App Data Folder points to the current language file
Sample contents of "Language.ini":
[Settings]
LanguageFile=Reference.lng
Without "Language.ini" the app will load with embedded English strings.
- You must restart XYplorer to reread an updated language file.
- "TipOfTheDay.htm" contents are NOT included. This file should be translated by itself if desired.
- "CatalogDefault.dat" contents are NOT included. This file should be
translated by itself if desired. (Currently the app will NOT load
"CatalogDefault.dat" when a language other than English is loaded.
Format of Reference.lng
~~~~~~~~~~~~~~~~~~~~~~~
- The file is organized in various sections. For internal reasons
mostly. Ultimately it's all about speed and memory.
- sample entry:
co.0074= Toggle Info Panel--- Toggle Info &Panel
------- ----------------- ------------------
ID ORIGINAL TRANSLATION
- do not change ID
- do not change ORIGINAL
- do not change the order of items
- just work on the TRANSLATION
- keep spaces left and right
- some ORIGINALs are prefixed with a tzype descriptor to guide the translator:
- caption: -> mind the length!! (GUI item should not break layout)
- menu: -> length not important.
- tooltip: -> length not important.
- tag: -> length not important.
- do not translate <$variables>
- ; you can add comment lines as you like by prefixing them with ;
- Line feeds are written as \n.
- Tabs are written as \t.
- Accelerators (&Panel) can be given in TRANSLATION. They are not shown in ORIGINAL.
Grammatical Number
~~~~~~~~~~~~~~~~~~
Examples:
<#> <file;files> found
<#> <file;~s> found
<#> <file;~s> <has been;have been> found
<#> <file;~s> and <2:#> <2:folder;~s>
Explanation:
<#> = the number itself
<singular form;plural form> = a word (noun/adj/verb) in agreement to this number
~ = placeholder for the first form (practical in many languages with affixing morphology)
<2:#> = a second number itself (agreeing with <2:folder;~s>)
- Grammatical number is preset to Western European (English, German, Italian, Portuguese, Spanish) type <one;other>
- Note that French (n3) might need <zero/one;other> (ask me for details)
- Other number systems are supported (ask me for details), e.g. Russian/Slavic (n5) <one;few;many;other>
- There is a scripting function for debugging grammatical number:
::lang_testnum "<#> <n5:файл;файла;файлов;файлов>", 11
Suffixes
~~~~~~~~
- Do not translate {suffixes}; they are just there for disambiguation, e.g.: cut{noun} vs cut{infinitive} vs cut{imperative} vs cut{perfect participle}
- "{dropdown}": careful with the the commas or semicolons; don't add or remove!! a mistake will confuse the commands!!
- "{menu}": careful with the the commas or semicolons; don't add or remove!! a mistake will confuse the commands!!
========================================================================
Code: Select all
$refNm = "Reference.lng";
$sep = "--- ";
$tart = "12"; // adjust here so you can resume your work peacefully...
$base = readfile("<curitem>");
$filename = "<curname>";
$tt = gettoken($base, count, "<crlf>");
IF ($refNm == $filename) { }
ELSEIF ($refNm != $filename) {
//a cool 'ok/cancel' feature is planned... someday, one day...
echo "warning!<crlf>Chosen<crlf>'$filename'doesn't match expected<crlf>'$refNm' for the file name...";
}
$ttfix = $tt - $tart;
while($tart <= $tt) {
$tart++;
$tk = gettoken($base, $tart, "<crlf>");
$ctrl++;
$tst = gettoken($tk, 2, "$sep");
IF ($tst == "") { continue; }
ELSEIF ($tst != "") {
$src = gettoken($tk, 1, "$sep");
//expect better output for ops to go the same day the 'ok/cancel' reaches the light...
$tr = input("Enter the string to be translated, please! (# $ctrl processing now, $ttfix to go...)", "Source: $src", $tst, w, , 1240);
writefile ("XYtranslation" . "$filename", "$src" . "$sep" . "$tr<crlf>", a);
}
}
echo "Now, publish it!<crlf>(don't forget to adjust the header for the produced file...)";
Wow, I thought it could be done via a GUI, but I didn't think you were so fast.SkyFrontier wrote:To make translation easier, XY style...
Inspired by this I will create an interface to the *.lng file, resp. to translation. A revolutionary approach to software translation with WYSIWYG preview of the translated control, and other bells and whistles. Translation should be as easy as possible and even fun. Especially when you don't get paid for it.admin wrote:Wow, I thought it could be done via a GUI, but I didn't think you were so fast.SkyFrontier wrote:To make translation easier, XY style...
Thanks, Dmitry!DmFedorov wrote:XY v11.70.0103
Find Files/Date/Predefined Intervals (button) - no translation for button-menu
Such as
&Leave Field "and/add" Empty°60,,&Help
&Today°1,This &Week,This &Month,This &Year,,
I don't know why.
--------------
I have not found translation lines for Category_Names in dialogue "Manage UDC"
-----------------
Menu (no Translation for items:)
File | Exit (saving)
View | Sort by | (Ascending) and (Descending)
User | Manage Commnads
Favorites | Labels (None, Red Orange....)
Favorites | Apply Last Label
Tools | Customize List | Date Column Format | (System Short Date), (System Long Date), (System Time), (Zodiac) and all Zodiac_Names
--------------
Help | Various Information | - all items (and Various Information with Crtl too)
--------------
Buttons on Control Panel (Main Set):
Up - Breadcrumb (popup to dropdown List)
Context_menu_buttons:
New Folder - New Shortcut, New Path, New Folders, New Files
Copy, Cut, Paste - Paste Spezial
Branch View - Persist across Folders, Toggle on same Query, Auto-refresh, Level indent, Multi-branch view Lists Top Folders, Configure Branch View
Mini Tree - Fully Collapse Folder, Optimize Tree, Auto-optimize Tree
-----------
Custom Buttons - Edit, Click
-----------
dialogue:
#705; List of all Commands, Click Ok to call a selected command + Context menu: Copy Item, Copy all items
+ items in list of Commands:
- submenu -,Batch Rename...,RegExp Rename...,Search and Replace...,Keep Particular Characters...,Set Extension...,Edit Item Names...,Spaces to _,_ to Spaces,Replace Umlauts,Remove Diacritics,UrlEscape (Space > %20 ...),UrlUnescape (%20 > Space ...),Unicode to UTF-8,UTF-8 to Unicode,New Shortcut...,New Path...,New Folders...,New Files...,Program Files,Windows Folder,System Folder,Temp Folder,Temporary Internet Files,Network Shortcuts,None,Red,Orange,Yellow,Green,Blue,Purple,Grey,[Label #8]..[Label #15],Apply Last Label,Manage Commands...,Go To,Open,Open With,Move To,Copy To,Backup To,New,Rename,Run Script,Load Script File
#602;
Scope: - Tree, List, Catalog, AddressBar, Triggered on KeyDown, Triggered on KeyUp, Global
Description: - [Pop-up submenu]
Press new shortcut: - Currently assigned to, already assigned to this Command, ...back to previous command
button All Free Shortcuts..|Tips - Strings of Tips-Window
---------------------------------------------------------
Ok. To find the rest it is necessary to mark (for example with symbol ¶) the beginning of all lines in Reference.lng and then all that that has no symbol ¶ in dialogues is not translated. Very simple way.
Reference_lng_XY_with¶.7z http://rghost.ru/41290672
Code: Select all
+ MLS: Now the *.LNG file may also be in ASCII format (non-Unicode).
For most West-European languages ASCII is okay.Okay, maybe ASCII is not the right term, but those languages do not need the Unicode format but can use the 1 character = 1 byte system plus the local codepage.Marco wrote:Isn't English the only language that could use just ASCII?Code: Select all
+ MLS: Now the *.LNG file may also be in ASCII format (non-Unicode). For most West-European languages ASCII is okay.
For example, Italian absolutely requires "è", French too has some stressed vowels, and German has umlauts.