two translations in one interface

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

two translations in one interface

Daniel Marecek
Hello everybody,

i would like to ask, if exists any elegant way to display more
translations of one string in one interface?

For example: VuFind is set to english localization, so data string of
record is for example "dog" and next to is displayed the same string,
but in other language, for example in german "hund", and so on.

Hope it is understandable.

Thank you for your reply.

Daniel Mareček
National Library of Technology
Prague, CZE

--
Oddělení ict služeb
Národní technická knihovna
tel: +420 232 002 448

http://www.techlib.cz/


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Vufind-tech mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-tech
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: two translations in one interface

Demian Katz

Daniel,


Here is where VuFind sets up its translations:


https://github.com/vufind-org/vufind/blob/a07b0bee7e8d9d28b5bbf904631047237518e59a/module/VuFind/src/VuFind/Bootstrapper.php#L333


I believe that if you load additional language files with different $language values, you could then call setLocale() on the translator object in order to switch between translations. I'm not sure whether there is an existing view helper that will let you switch locale from within a view, but if it's not already there, it would not be difficult to build.


We do already do a little bit of language-switching in the existing VuFind code, since the language choice drop-down has its own separate translation file for mapping English language names from the config file into the native versions of those names. Here is the view helper that makes that happen:


https://github.com/vufind-org/vufind/blob/master/module/VuFind/src/VuFind/View/Helper/Root/DisplayLanguageOption.php


Please let me know if you still have any questions about this.


- Demian



From: Daniel Mareček <[hidden email]>
Sent: Friday, January 27, 2017 6:09 AM
To: [hidden email]
Subject: [VuFind-Tech] two translations in one interface
 
Hello everybody,

i would like to ask, if exists any elegant way to display more
translations of one string in one interface?

For example: VuFind is set to english localization, so data string of
record is for example "dog" and next to is displayed the same string,
but in other language, for example in german "hund", and so on.

Hope it is understandable.

Thank you for your reply.

Daniel Mareček
National Library of Technology
Prague, CZE

--
Oddělení ict služeb
Národní technická knihovna
tel: +420 232 002 448

https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.techlib.cz%2F&data=01%7C01%7Cdemian.katz%40villanova.edu%7C1858f7fbadae45a6d92c08d446a7694b%7C765a8de5cf9444f09cafae5bf8cfa366%7C1&sdata=qshCtdikPm%2FC%2F9WJdndqpFdIRAO0Z4k0dKRKFDQNd5g%3D&reserved=0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsdm.link%2Fslashdot&data=01%7C01%7Cdemian.katz%40villanova.edu%7C1858f7fbadae45a6d92c08d446a7694b%7C765a8de5cf9444f09cafae5bf8cfa366%7C1&sdata=oqb%2BPrwmhgxgXPfgCAST%2F23jHF%2BuEFKgnHAxZrBaq8Y%3D&reserved=0
_______________________________________________
Vufind-tech mailing list
[hidden email]
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fvufind-tech&data=01%7C01%7Cdemian.katz%40villanova.edu%7C1858f7fbadae45a6d92c08d446a7694b%7C765a8de5cf9444f09cafae5bf8cfa366%7C1&sdata=gFsU4XcWL7xcUX%2BypOT33Y4ADKq89m2HIpD9hpAL%2F2E%3D&reserved=0

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Vufind-tech mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-tech
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: two translations in one interface

Daniel Marecek
Thank you Demian.

I created new view helper (inspired of DisplayLanguageOption helper) and it is done. It works fine.

Have a nice time.
Dan

P.S.: Our source code will be public on github, soon.

Dne 27.1.2017 v 14:09 Demian Katz napsal(a):

Daniel,


Here is where VuFind sets up its translations:


https://github.com/vufind-org/vufind/blob/a07b0bee7e8d9d28b5bbf904631047237518e59a/module/VuFind/src/VuFind/Bootstrapper.php#L333


I believe that if you load additional language files with different $language values, you could then call setLocale() on the translator object in order to switch between translations. I'm not sure whether there is an existing view helper that will let you switch locale from within a view, but if it's not already there, it would not be difficult to build.


We do already do a little bit of language-switching in the existing VuFind code, since the language choice drop-down has its own separate translation file for mapping English language names from the config file into the native versions of those names. Here is the view helper that makes that happen:


https://github.com/vufind-org/vufind/blob/master/module/VuFind/src/VuFind/View/Helper/Root/DisplayLanguageOption.php


Please let me know if you still have any questions about this.


- Demian



From: Daniel Mareček [hidden email]
Sent: Friday, January 27, 2017 6:09 AM
To: [hidden email]
Subject: [VuFind-Tech] two translations in one interface
 
Hello everybody,

i would like to ask, if exists any elegant way to display more
translations of one string in one interface?

For example: VuFind is set to english localization, so data string of
record is for example "dog" and next to is displayed the same string,
but in other language, for example in german "hund", and so on.

Hope it is understandable.

Thank you for your reply.

Daniel Mareček
National Library of Technology
Prague, CZE

--
Oddělení ict služeb
Národní technická knihovna
tel: +420 232 002 448

https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.techlib.cz%2F&data=01%7C01%7Cdemian.katz%40villanova.edu%7C1858f7fbadae45a6d92c08d446a7694b%7C765a8de5cf9444f09cafae5bf8cfa366%7C1&sdata=qshCtdikPm%2FC%2F9WJdndqpFdIRAO0Z4k0dKRKFDQNd5g%3D&reserved=0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsdm.link%2Fslashdot&data=01%7C01%7Cdemian.katz%40villanova.edu%7C1858f7fbadae45a6d92c08d446a7694b%7C765a8de5cf9444f09cafae5bf8cfa366%7C1&sdata=oqb%2BPrwmhgxgXPfgCAST%2F23jHF%2BuEFKgnHAxZrBaq8Y%3D&reserved=0
_______________________________________________
Vufind-tech mailing list
[hidden email]
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fvufind-tech&data=01%7C01%7Cdemian.katz%40villanova.edu%7C1858f7fbadae45a6d92c08d446a7694b%7C765a8de5cf9444f09cafae5bf8cfa366%7C1&sdata=gFsU4XcWL7xcUX%2BypOT33Y4ADKq89m2HIpD9hpAL%2F2E%3D&reserved=0


-- 
Oddělení ict služeb
Národní technická knihovna
tel: +420 232 002 448

http://www.techlib.cz/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Vufind-tech mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-tech
Loading...