I'm setting up a Typo3 site, with a default language of English, and a German translation (id=1).
However, on the German translation, I need to be able to create additional content elements in the 'default' column that do not exist in the default.
However, whenever I try to create new content elements, they are showing up in BE, but on the frontend it only renders ones that were created with the 'Copy Default' button.
This is my config:
config.linkVars = L
config.uniqueLinkVars = 1
config.sys_language_overlay = default
config.sys_language_mode = content_overlay
config.language = en
config.locale_all = en_EN
config.htmlTag_langKey = en-EN
config.sys_language_uid = 0
[browser = msie]
config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml" xmlns:v=”urn:schemas-microsoft-com:vml” xml:lang="en"
[globalVar = GP:L = 1]
config.language = de
config.locale_all = de_DE
config.htmlTag_langKey = de-DE
config.sys_language_uid = 1
[globalVar = GP:L = 1] && [browser = msie]
config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml" xmlns:v=”urn:schemas-microsoft-com:vml” xml:lang="de"
[global]
I've copied over the 2 default elements, then tried to add additional elements that are not rendering.
I've not worked with TYPO3 before, but I'm pretty sure those additional content elements should be rendered? Do I need to include any additional markup in the templates to enable it?
Try this:
config.sys_language_overlay = hideNonTranslated
config.sys_language_mode = strict
[globalVar = GP:L = 1]
config.sys_language_overlay = 0
[end]
By setting config.sys_language_overlay = 0, TYPO3 should display your german records even if there is no record in the default language.
Also i corrected your default values for config.sys_language_overlay and config.sys_language_mode since they are not valid.
The documentation can be found at TSREF.
Answering my own question for future visitors...
When you set config.sys_language_overlay it tells Typo3 to actually get all the records from the default language, and then just overlay the matches over the top - that way, it will only show translated elements that have been descended from the default language.
Taking that out completly, it then allows you to use as many content elements in a translation as you want, without paying attention to the default language.
As #Shufla mentioned, using config.sys_language_mode = strict then means that any translations that have less elements than the default won't then inherit the default language ones.
Related
I have a custom dialog dynpro including an input field named DYN_MATNR as listbox for which I have included a list of particular materials as selection.
How can I set a specific material (of that list) as selected when the dialog dynpro is opened?
PBO of dialog dynpro:
data lt_values type vrm_values.
select matnr,
maktx
into table #data(lt_materials)
from makt
where matnr in #so_matnr
and spras = 'D'
order by matnr.
loop at lt_materials assigning field-symbol(<material>).
append initial line to lt_values assigning field-symbol(<value>).
<value>-key = <material>-matnr.
<value>-text = <material>-maktx.
endloop.
call function 'VRM_SET_VALUES'
exporting
id = 'DYN_MATNR'
values = lt_values
exceptions
id_illegal_name = 1
others = 2.
if sy-subrc <> 0.
" ...
endif.
This works and it shows the list of materials as listbox values. To select a particular material I have included the FM DYNP_VALUES_UPDATE afterwards and also in PBO but this did not work:
data lv_stepl type syst-stepl.
call function 'DYNP_GET_STEPL'
importing
povstepl = lv_stepl
exceptions
stepl_not_found = 1
others = 2.
if sy-subrc <> 0.
" ...
endif.
data(lt_dynpfields) = value dynpread_tabtype(
( fieldname = 'DYN_MATNR'
stepl = lv_stepl
fieldvalue = gcl_helper->get_matnr( ) " matnr which should be selected is stored here
fieldinp = space )
).
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-repid
dynumb = sy-dynnr
tables
dynpfields = lt_dynpfields
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
others = 8.
if sy-subrc <> 0.
" ...
endif.
I am also not able to directly set DYN_MATNR as it is not available in PBO.
Any hints?
Got it:
You need to additionally define a global(!) variable with the name and (wished) type of the input field (e.g. in the top include of the report or in a separate include of the dynpro logic):
data dyn_matnr type matnr.
Then you can set the initial value of the dynpro field in PBO directly:
dyn_matnr = gcl_helper->get_matnr( ).
As this becomes rather irritating when using various dialog dynpros I recommend including the dynpro number in those variables and input fields.
Log4j2 provides various kind of filters [1] and these can be configured at four levels:
Context-wide
Logger
Appender
Appender Reference
In my use-case, I would like to setup a CompositeFilter at a specified Logger (level 2 from above) using the property file syntax.
For the sake of the example let's assume that we want to setup a composite filter composed from two RegexFilter matching .*SQL.* and .*JPQL.* respectively. Assuming that we have the following events:
logger.info("Messase with no keyword");
logger.info("Messase with SQL keyword");
logger.info("Messase with JPQL keyword");
logger.info("Messase with both SQL and JPQL keywords");
Only the last event should pass from the composite filter.
I made several attempts [2] (also outlined below) to get the desired output but I wasn't able to figure out how to properly setup a CompositeFilter using the property syntax so any help would be greatly appreciated.
Attempt 0
logger.t1.filter.f1.type = RegexFilter
logger.t1.filter.f1.regex = .*SQL.*
logger.t1.filter.f1.onMatch = NEUTRAL
logger.t1.filter.f1.onMismatch = DENY
logger.t1.filter.f2.type = RegexFilter
logger.t1.filter.f2.regex = .*JPQL.*
logger.t1.filter.f2.onMatch = ACCEPT
logger.t1.filter.f2.onMismatch = DENY
logger.t1.appenderRefs = a
logger.t1.appenderRef.a.ref = L0
Attempt 1
logger.t1.filters = f1, f2
logger.t1.filter.f1.type = RegexFilter
logger.t1.filter.f1.regex = .*SQL.*
logger.t1.filter.f1.onMatch = NEUTRAL
logger.t1.filter.f1.onMismatch = DENY
logger.t1.filter.f2.type = RegexFilter
logger.t1.filter.f2.regex = .*JPQL.*
logger.t1.filter.f2.onMatch = ACCEPT
logger.t1.filter.f2.onMismatch = DENY
Attempt 2
logger.t1.filters.f1.type = RegexFilter
logger.t1.filters.f1.regex = .*SQL.*
logger.t1.filters.f1.onMatch = NEUTRAL
logger.t1.filters.f1.onMismatch = DENY
logger.t1.filters.f2.type = RegexFilter
logger.t1.filters.f2.regex = .*JPQL.*
logger.t1.filters.f2.onMatch = ACCEPT
logger.t1.filters.f2.onMismatch = DENY
logger.t1.appenderRefs = a
logger.t1.appenderRef.a.ref = L0
Attempt 3
logger.t1.filter.M.type = Filters
logger.t1.filter.M.f1.type = RegexFilter
logger.t1.filter.M.f1.regex = .*SQL.*
logger.t1.filter.M.f1.onMatch = NEUTRAL
logger.t1.filter.M.f1.onMismatch = DENY
logger.t1.filter.M.f2.type = RegexFilter
logger.t1.filter.M.f2.regex = .*JPQL.*
logger.t1.filter.M.f2.onMatch = ACCEPT
logger.t1.filter.M.f2.onMismatch = DENY
logger.t1.appenderRefs = a
logger.t1.appenderRef.a.ref = L0
Some further clarifications:
I am strictly interested for setting up a CompositeFilter, not
write a custom filter, not use a single combined RegexFilter etc.
I am interested to see how it is done using the property syntax, not
XML, JSON, or other.
[1] https://logging.apache.org/log4j/2.x/manual/filters.html
[2] https://github.com/zabetak/logging-log4j2/commit/a9944885100db42f7e3ba1b3ff81d59b743d0ab7
There are two problems with your configuration:
A LoggerConfig accepts only a single filter. If you want to use multiple filters, configure a CompositeFilter explicitly (which has a plugin name "Filters),
The order of filters in a properties configuration file is basically random, since Properties is a Hashtable and does not have a predefined order.
Considering the two facts above a variation of your attempt 3 should work:
logger.t1.filter.M.type = Filters
logger.t1.filter.M.f1.type = RegexFilter
logger.t1.filter.M.f1.regex = .*SQL.*
logger.t1.filter.M.f1.onMatch = NEUTRAL
logger.t1.filter.M.f1.onMismatch = DENY
logger.t1.filter.M.f2.type = RegexFilter
logger.t1.filter.M.f2.regex = .*JPQL.*
logger.t1.filter.M.f2.onMatch = NEUTRAL
logger.t1.filter.M.f2.onMismatch = DENY
Both filters return NEUTRAL, when the pattern matches, which guarantees that an inversion of the order of filters does not break the logic.
How can we convert language of URL as website language changes?
Like take example of www.example.com/test it is in English. When I am changing website language to Persian it should be www.example.com/آزمون.
Is it possible? How can we achieve this?
If you are using PHP, this may help. You can change the language as you wish, depending on what language you want your website to be in.
/*
-----------------
Language: German
-----------------
*/
$lang = array();
$lang['PAGE_TITLE'] = 'Meine Webseite Titel';
$lang['HEADER_TITLE'] = 'Meine Website-Header Titel';
$lang['SITE_NAME'] = 'Meine Website';
$lang['SLOGAN'] = 'Mein Slogan hier';
$lang['HEADING'] = 'Position';
// Menu
$lang['MENU_HOME'] = 'Heim';
$lang['MENU_ABOUT_US'] = 'Über uns';
$lang['MENU_OUR_PRODUCTS'] = 'Unsere Produkte';
$lang['MENU_CONTACT_US'] = 'Kontaktieren Sie uns';
$lang['MENU_ADVERTISE'] = 'Werben';
$lang['MENU_SITE_MAP'] = 'Site Karte';
Also check out this thread.
I want to add a fontsize selector in typo3 6.2. so I have created the following three files:
fontsize_normal.css
fontsize_medium.css
fontsize_large.css
and the relevant typoscript settings looks as follows:
config {
linkVars = L(0-2)
uniqueLinkVars = 1
}
obj.fontsize = COA
obj.fontsize {
1 = TEXT
1.wrap = <div>|</div>
1.value = A
1.value.typolink.parameter.data = page:uid
1.value.typolink.additionalParams = &L=0
2 < .1
2.wrap = <div>|</div>
2.value = A+
2.value.typolink.additionalParams = &L=1
3 < .1
3.wrap = <div>|</div>
3.value = A++
3.value.typolink.additionalParams = &L=2
}
But if I include the css I am getting a blank screen, so something should be wrong
page = PAGE
page {
includeCSS {
[globalVar = GP:L = 0]
selectorcss = fileadmin/system/Public/Css/fontsize_normal.css
[globalVar = GP:L = 1]
selectorcss = fileadmin/system/Public/Css/fontsize_medium.css
[globalVar = GP:L = 2]
selectorcss = fileadmin/system/Public/Css/fontsize_large.css
[global]
}
}
Multiple problems here :
'L' is used as the language variable. Using this (without disabling it) will conflict with TYPO3's languages selection. You will need to create your own variable.
Conditions can not be used INSIDE your typoscript:
[globalVar = GP:L = 0]
page = PAGE
page {
includeCSS {
selectorcss = fileadmin/system/Public/Css/fontsize_normal.css
}
}
[global]
Aldo you can create a font size selector with typoscript, I think a javascript approach would be much easier and flexible.
It will give you the option to manipulate your DOM (or replacing your stylesheet, or loading a new stylesheet, or setting a new body font-size , etc ...) and you can safe your settings in a cooky for further use.
On a usability point of view, Font-size selectors are obsolete: Users can set there own font size in a browser & font-sizes should be relative (using em's instead of px)..
I get the following error in caret trainControl() using the custom methods syntax documented in the package vignette (pdf) on page 46. Does anyone know if this document out of date or incorrect? It seems at odds with the caret documentation page where the "custom" parameter is not used.
> fitControl <- trainControl(custom=list(parameters=lpgrnn$grid, model=lpgrnn$fit,
prediction=lpgrnn$predict, probability=NULL,
sort=lpgrnn$sort, method="cv"),
number=10)
Error in trainControl(custom = list(parameters = lpgrnn$grid, model = lpgrnn$fit, :
unused argument (custom = list(parameters = lpgrnn$grid, model = lpgrnn$fit,
prediction = lpgrnn$predict, probability = NULL, sort = lpgrnn$sort, method = "cv",
number = 10))
The cited pdf is out of date. The caret website is the canonical source of documentation.