Copy link to clipboard
Copied
Dear all,
To be 'really correct' in my Calendar axis function I want to write the month-names in the language of the anchoring paragraph (as long as it is de, en or fr).
Do I need to run through all paragraphs of the text frame and check whether GetText provides andy anchors
... and then look what is anchored (fortunaely I know the ID of my frame... ?
The anchored frame has a text location, which points to an object which is the paragraph you are looking for.
oPgf = oFrame.TextLoc.obj
You should of course always check if oPgf is really a paragraph: if ( oPgf.constructor.name == "Pgf" ) as it may just be something else in one of those corner cases and throw an ugly script error, or even crash Frame.
Good luck
4everJang
Copy link to clipboard
Copied
The anchored frame has a text location, which points to an object which is the paragraph you are looking for.
oPgf = oFrame.TextLoc.obj
You should of course always check if oPgf is really a paragraph: if ( oPgf.constructor.name == "Pgf" ) as it may just be something else in one of those corner cases and throw an ugly script error, or even crash Frame.
Good luck
4everJang
Copy link to clipboard
Copied
Many thanks, Jang!
I created a function to get the default language:
function Fgr_GetDefaultLanguage (oPgf) { // === Get language from paragraph or application ========
// Arguments oPgf Paragraph from which to get the language
// Returns language string "en", "de" or "fr"
// Called by NewDiagram
// Comment Only languages which can be handled in messages are considered
// Reference Jang F.M. Graat in https://forums.adobe.com/message/11070209
var langNum;
if (oPgf.constructor.name == "Pgf") { // assure proper object
langNum = oPgf.Language;
} else {
langNum = app.Language;
}
switch (langNum) {
case Constants.FV_LANG_ENGLISH : return "en"; // x01
case Constants.FV_LANG_BRITISH : return "en"; // x02
case Constants.FV_LANG_GERMAN : return "de"; // x03
case Constants.FV_LANG_SWISS_GERMAN : return "de"; // x04
case Constants.FV_LANG_FRENCH : return "fr"; // x05
case Constants.FV_LANG_CANADIAN_FRENCH : return "fr"; // x06
case Constants.FV_LANG_NEW_GERMAN : return "de"; // x16
case Constants.FV_LANG_NEW_SWISS_GERMAN : return "de"; // x17
default : return "en";
}
} //--- end Fgr_GetDefaultLanguage