File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## 1.0.1 (released 2016-05-20)
4+
5+ - Add lang to trans helper
6+
37## 1.0.0 (released 2016-05-11)
48
59- First stable release
Original file line number Diff line number Diff line change 1717 *
1818 * @param array $groups
1919 *
20- * @throws BadFunctionCallException
20+ * @throws \ BadFunctionCallException
2121 *
2222 * @return void
2323 */
@@ -40,17 +40,22 @@ function register_translations(array $groups)
4040 * Get translations by their strings.
4141 *
4242 * @param string $key
43+ * @param string|null $lang
4344 *
44- * @throws BadFunctionCallException
45+ * @throws \ BadFunctionCallException
4546 *
4647 * @return string
4748 */
48- function trans ($ key )
49+ function trans ($ key, $ lang = null )
4950 {
5051 if (!function_exists ('pll__ ' )) {
5152 throw new BadFunctionCallException ('Please active the Polylang plugin. ' );
5253 }
5354
55+ if ($ lang ) {
56+ return pll_translate_string ($ key , $ lang );
57+ }
58+
5459 return pll__ ($ key );
5560 }
5661}
You can’t perform that action at this time.
0 commit comments