<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Thanks, Troy. This is helpful!<br>
I'll look into this tomorrow.</p>
<p>Best regards,<br>
Tobias<br>
</p>
<div class="moz-cite-prefix">On 5/15/20 8:22 PM, Troy A. Griffitts
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:d5942509-3011-c8f6-6d92-09f222287135@crosswire.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>Sorry, I forgot to respond to this.</p>
<p>Yes, you can have a look at sword/tests/parsekey.cpp</p>
<p>But basically, while you can directly use LocaleMgr to
translate any strings, even strings in your application if you
augment SWORD's locale's with your application string with
something like:</p>
<p>LocaleMgr::getSystemLocaleMgr()->loadConfigDir(SWBuf("~/.myapp/locales.d");</p>
<p>.. only the [Text] section is used directly for the translate
method. E.g., if your application has some strings you'd like
to add to SWORD's translatable strings, for German, you might
add a file:</p>
# ~/.myapp/locales.d/de-utf8.conf<br>
#
<p>[Meta]<br>
Name=de<br>
Description=Deutsch (Unicode)<br>
Encoding=UTF-8<br>
Contributor=Justin Bellars <a class="moz-txt-link-rfc2396E"
href="mailto:jbellars@gmail.com" moz-do-not-send="true"><jbellars@gmail.com></a><br>
Contributor=Ulrich Schmid <a class="moz-txt-link-rfc2396E"
href="mailto:schmid.ub@googlemail.com" moz-do-not-send="true"><schmid.ub@googlemail.com></a><br>
<br>
[Text]<br>
View=Abrufen<br>
Bibles=Bibeln<br>
Language Assist=Sprachförderung<br>
Commentary Assist=Kommentarförderung<br>
Verse Study=Vers-für-Vers-Analyse<br>
Bookmarks=Lesezeichen<br>
</p>
<p>...</p>
<p>Any strings in this section will be available to LocaleMgr's
translate method, including all the ones that come default with
SWORD.</p>
<p>The other sections (sections besides [Text] in SWORD's locale
files are not specifically for directly translation. They are
used by SWORD's verse parser VerseKey translation, etc.</p>
<p>The typically way an app uses all this is (not usually all in
one place each time they want a translated book name, but for
ordering purposes all in one place...):</p>
const char *usersPreferredLocaleName = "de"<br>
const char *bookTerm = "Gen";<br>
const char *activeBibleName = "KJVA";<br>
<br>
LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(usersPreferredLocaleName);<br>
<br>
SWMgr library;<br>
SWModule *bible = library.getModule(activeBibleName);<br>
<br>
VerseKey *vk = (VerseKey *)bible->getKey();<br>
vk->setText(bookTerm);<br>
<br>
std::string translatedAbbreviation = vk->getBookAbbrev();<br>
<br>
<p><br>
</p>
<p>In summery, usually a user's preferred locale is set
systemwide. Then everything is generally switched to that
locale, i.e., VerseKey output will be in that locale so when you
getBookAbbrev, you will get German.</p>
<p>You can do lower level work if you'd like. SWKey has a
setLocale method if you'd like to set just a single key to a
different language. But typically our frontends set default
locale systemwide before constructing SWMgr.</p>
<p>Hope this helps,</p>
<p>Troy</p>
<p><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 5/15/20 10:38 AM, Tobias Klein
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:f8e22f17-b2a7-7265-7b69-631c569d910b@tklein.info">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<p>Hi Peter,</p>
<p>Why is it then that mapping tables like this one are kept in
the locales.d files:<br>
</p>
<div style="color: #d4d4d4;background-color: #1e1e1e;font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span style="color: #d4d4d4;">[Pref Abbrevs]</span></div><div><span style="color: #569cd6;">Gen</span><span style="color: #d4d4d4;">=1Mo</span></div><div><span style="color: #569cd6;">Exod</span><span style="color: #d4d4d4;">=2Mo</span></div><div><span style="color: #569cd6;">Lev</span><span style="color: #d4d4d4;">=3Mo</span></div><div><span style="color: #569cd6;">Num</span><span style="color: #d4d4d4;">=4Mo</span></div><div><span style="color: #569cd6;">Deut</span><span style="color: #d4d4d4;">=5Mo</span></div><div><span style="color: #569cd6;">Josh</span><span style="color: #d4d4d4;">=Jos</span></div><div><span style="color: #569cd6;">Judg</span><span style="color: #d4d4d4;">=Rich</span></div><div><span style="color: #569cd6;">Ruth</span><span style="color: #d4d4d4;">=Rut</span></div><div><span style="color: #569cd6;">1Sam</span><span style="color: #d4d4d4;">=1Sam</span></div><div><span style="color: #569cd6;">2Sam</span><span style="color: #d4d4d4;">=2Sam</span></div><div><span style="color: #569cd6;">1Kgs</span><span style="color: #d4d4d4;">=1Kön</span></div><div><span style="color: #569cd6;">2Kgs</span><span style="color: #d4d4d4;">=2Kön</span></div><div><span style="color: #569cd6;">1Chr</span><span style="color: #d4d4d4;">=1Chr</span></div><div><span style="color: #569cd6;">2Chr</span><span style="color: #d4d4d4;">=2Chr</span></div><div><span style="color: #569cd6;">Ezra</span><span style="color: #d4d4d4;">=Esr</span></div><div><span style="color: #569cd6;">Neh</span><span style="color: #d4d4d4;">=Neh</span></div></div>
<p>This is the info I need. I'm just wondering how to extract
that information with the SWORD API.<br>
</p>
<p>Best regards,<br>
Tobias</p>
<div class="moz-cite-prefix">On 5/15/20 7:19 PM, Peter Von
Kaehne wrote:<br>
</div>
<blockquote type="cite"
cite="mid:trinity-83a1f28d-6db7-4dd6-9438-21b388f7e9c2-1589563152776@3c-app-gmx-bs33">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<div style="font-family: Verdana;font-size: 12.0px;">
<div> </div>
<div>
<div>I think the lack of response is as there is no
sensible way of responding.<br>
<br>
The whole construct of abbreviations (irrespective of
languages) is uniderectional (Abbr->Book name). The
same applies to English. What you mix up here is that a
particular subset of English abbreviations is also the
set of OSIS identifiers.</div>
<div><br>
Peter</div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px;
padding: 10px 0 10px 10px; border-left:2px solid
#C3D9E5; word-wrap: break-word; -webkit-nbsp-mode:
space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Freitag,
15. Mai 2020 um 18:03 Uhr<br>
<b>Von:</b> "Tobias Klein" <a
class="moz-txt-link-rfc2396E"
href="mailto:contact@tklein.info"
moz-do-not-send="true"><contact@tklein.info></a><br>
<b>An:</b> "SWORD Developers' Collaboration Forum" <a
class="moz-txt-link-rfc2396E"
href="mailto:sword-devel@crosswire.org"
moz-do-not-send="true"><sword-devel@crosswire.org></a><br>
<b>Betreff:</b> Re: [sword-devel] How to get
translated book abbreviations with LocaleMgr?</div>
<div name="quoted-content">
<div>Hi,
<div> </div>
<div>Any feedback regarding this question?</div>
<div>I would appreciate it!</div>
<div> </div>
<div>Best regards,</div>
<div>Tobias
<div>
<blockquote>
<div>Am 10.05.2020 um 12:45 schrieb Tobias
Klein <<a
href="mailto:contact@tklein.info"
onclick="parent.window.location.href='mailto:contact@tklein.info';
return false;" target="_blank"
moz-do-not-send="true">contact@tklein.info</a>>:</div>
<div>
<div>
<p>Hi,</p>
<p>how can I use the LocaleMgr to get a
translated book abbreviation?<br>
<br>
For some reason this code did not work
for me:</p>
<div style="color: rgb(212,212,212);background-color: rgb(30,30,30);font-family: "Droid Sans Mono" , monospace , monospace , "Droid Sans Fallback";font-weight: normal;font-size: 14.0px;line-height: 19.0px;white-space: pre;">
<div><span style="color: rgb(78,201,176);">sword</span><span style="color: rgb(212,212,212);">::SWLocale* locale = </span><span style="color: rgb(86,156,214);">this</span><span style="color: rgb(212,212,212);">-></span><span style="color: rgb(156,220,254);">_localeMgr</span><span style="color: rgb(212,212,212);">-></span><span style="color: rgb(220,220,170);">getLocale</span><span style="color: rgb(212,212,212);">(</span><span style="color: rgb(156,220,254);">localeCode</span><span style="color: rgb(212,212,212);">);</span></div>
<div><span style="color: rgb(78,201,176);">std</span><span style="color: rgb(212,212,212);">::string translatedAbbreviation = </span><span style="color: rgb(78,201,176);">std</span><span style="color: rgb(212,212,212);">::</span><span style="color: rgb(220,220,170);">string</span><span style="color: rgb(212,212,212);">(</span><span style="color: rgb(156,220,254);">locale</span><span style="color: rgb(212,212,212);">-></span><span style="color: rgb(220,220,170);">translate</span><span style="color: rgb(212,212,212);">(</span><span style="color: rgb(156,220,254);">bookTerm</span><span style="color: rgb(212,212,212);">));</span></div>
</div>
<p>I was using "de" as a locale and
"Gen" as the term to be translated,
but I did not get the german variant
of "Gen", but rather the exact same
term "Gen" as a result.</p>
<p>Best regards,<br>
Tobias</p>
</div>
_______________________________________________<br>
sword-devel mailing list: <a
href="mailto:sword-devel@crosswire.org"
onclick="parent.window.location.href='mailto:sword-devel@crosswire.org';
return false;" target="_blank"
moz-do-not-send="true">sword-devel@crosswire.org</a><br>
<a
href="http://www.crosswire.org/mailman/listinfo/sword-devel"
target="_blank" moz-do-not-send="true">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your
settings at above page</div>
</blockquote>
</div>
</div>
_______________________________________________
sword-devel mailing list: <a
class="moz-txt-link-abbreviated"
href="mailto:sword-devel@crosswire.org"
moz-do-not-send="true">sword-devel@crosswire.org</a>
<a
href="http://www.crosswire.org/mailman/listinfo/sword-devel"
target="_blank" moz-do-not-send="true">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings
at above page</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org" moz-do-not-send="true">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel" moz-do-not-send="true">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org" moz-do-not-send="true">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel" moz-do-not-send="true">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
</body>
</html>